react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / lib / action / append / constant.js
80742 views/*:nodoc:*1* class ActionAppendConstant2*3* This stores a list, and appends the value specified by4* the const keyword argument to the list.5* (Note that the const keyword argument defaults to null.)6* The 'appendConst' action is typically useful when multiple7* arguments need to store constants to the same list.8*9* This class inherited from [[Action]]10**/1112'use strict';1314var util = require('util');1516var Action = require('../../action');1718/*:nodoc:*19* new ActionAppendConstant(options)20* - options (object): options hash see [[Action.new]]21*22**/23var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {24options = options || {};25options.nargs = 0;26if (options.constant === undefined) {27throw new Error('constant option is required for appendAction');28}29Action.call(this, options);30};31util.inherits(ActionAppendConstant, Action);3233/*:nodoc:*34* ActionAppendConstant#call(parser, namespace, values, optionString) -> Void35* - parser (ArgumentParser): current parser36* - namespace (Namespace): namespace for output data37* - values (Array): parsed values38* - optionString (Array): input option string(not parsed)39*40* Call the action. Save result in namespace object41**/42ActionAppendConstant.prototype.call = function (parser, namespace) {43var items = [].concat(namespace[this.dest] || []);44items.push(this.constant);45namespace.set(this.dest, items);46};474849