[Groonga-commit] nroonga/nroonga at 9710b7d [master] Remove unnecessary code

Back to archive index

abetomo null+****@clear*****
Fri Sep 22 14:59:21 JST 2017


abetomo	2017-09-22 14:59:21 +0900 (Fri, 22 Sep 2017)

  New Revision: 9710b7df08908f01d431b73c4280d3d6f38ae682
  https://github.com/nroonga/nroonga/commit/9710b7df08908f01d431b73c4280d3d6f38ae682

  Merged 54ffa81: Merge pull request #30 from abetomo/clean_code

  Message:
    Remove unnecessary code
    
    For json you do not have to explicitly specify it.

  Modified files:
    lib/nroonga.js

  Modified: lib/nroonga.js (+2 -13)
===================================================================
--- lib/nroonga.js    2017-09-22 14:57:31 +0900 (747464f)
+++ lib/nroonga.js    2017-09-22 14:59:21 +0900 (b9e8656)
@@ -16,18 +16,8 @@ const optionsToCommandString = (command, options) => {
   return args.join(' ')
 }
 
-const overrideOutputType = (optionsGiven, type) => {
-  const options = {}
-  for (let key in optionsGiven) {
-    options[key] = optionsGiven[key]
-  }
-  options.output_type = type
-  return options
-}
-
 nroonga.Database.prototype.commandSync = function (command, options) {
-  const overridedOptions = overrideOutputType(options || {}, 'json')
-  const commandString = optionsToCommandString(command, overridedOptions)
+  const commandString = optionsToCommandString(command, options)
 
   return this.commandSyncString(commandString)
 }
@@ -38,8 +28,7 @@ nroonga.Database.prototype.command = function (command, options, callback) {
     options = {}
   }
 
-  const overridedOptions = overrideOutputType(options, 'json')
-  const commandString = optionsToCommandString(command, overridedOptions)
+  const commandString = optionsToCommandString(command, options)
 
   return this.commandString(commandString, callback)
 }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20170922/1f22c85b/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index