BVB Source Codes

reactide Show constant.js Source code

Return Download reactide: download constant.js Source code - Download reactide Source code - Type:.js
  1. /*:nodoc:*
  2.  * class ActionAppendConstant
  3.  *
  4.  * This stores a list, and appends the value specified by
  5.  * the const keyword argument to the list.
  6.  * (Note that the const keyword argument defaults to null.)
  7.  * The 'appendConst' action is typically useful when multiple
  8.  * arguments need to store constants to the same list.
  9.  *
  10.  * This class inherited from [[Action]]
  11.  **/
  12.  
  13. 'use strict';
  14.  
  15. var util = require('util');
  16.  
  17. var Action = require('../../action');
  18.  
  19. /*:nodoc:*
  20.  * new ActionAppendConstant(options)
  21.  * - options (object): options hash see [[Action.new]]
  22.  *
  23.  **/
  24. var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {
  25.   options = options || {};
  26.   options.nargs = 0;
  27.   if (typeof options.constant === 'undefined') {
  28.     throw new Error('constant option is required for appendAction');
  29.   }
  30.   Action.call(this, options);
  31. };
  32. util.inherits(ActionAppendConstant, Action);
  33.  
  34. /*:nodoc:*
  35.  * ActionAppendConstant#call(parser, namespace, values, optionString) -> Void
  36.  * - parser (ArgumentParser): current parser
  37.  * - namespace (Namespace): namespace for output data
  38.  * - values (Array): parsed values
  39.  * - optionString (Array): input option string(not parsed)
  40.  *
  41.  * Call the action. Save result in namespace object
  42.  **/
  43. ActionAppendConstant.prototype.call = function (parser, namespace) {
  44.   var items = [].concat(namespace[this.dest] || []);
  45.   items.push(this.constant);
  46.   namespace.set(this.dest, items);
  47. };
  48.  
downloadconstant.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top