BVB Source Codes

reactide Show append.js Source code

Return Download reactide: download append.js Source code - Download reactide Source code - Type:.js
  1. /*:nodoc:*
  2.  * class ActionAppend
  3.  *
  4.  * This action stores a list, and appends each argument value to the list.
  5.  * This is useful to allow an option to be specified multiple times.
  6.  * This class inherided from [[Action]]
  7.  *
  8.  **/
  9.  
  10. 'use strict';
  11.  
  12. var util = require('util');
  13.  
  14. var Action = require('../action');
  15.  
  16. // Constants
  17. var c = require('../const');
  18.  
  19. /*:nodoc:*
  20.  * new ActionAppend(options)
  21.  * - options (object): options hash see [[Action.new]]
  22.  *
  23.  * Note: options.nargs should be optional for constants
  24.  * and more then zero for other
  25.  **/
  26. var ActionAppend = module.exports = function ActionAppend(options) {
  27.   options = options || {};
  28.   if (this.nargs <= 0) {
  29.     throw new Error('nargs for append actions must be > 0; if arg ' +
  30.         'strings are not supplying the value to append, ' +
  31.         'the append const action may be more appropriate');
  32.   }
  33.   if (!!this.constant && this.nargs !== c.OPTIONAL) {
  34.     throw new Error('nargs must be OPTIONAL to supply const');
  35.   }
  36.   Action.call(this, options);
  37. };
  38. util.inherits(ActionAppend, Action);
  39.  
  40. /*:nodoc:*
  41.  * ActionAppend#call(parser, namespace, values, optionString) -> Void
  42.  * - parser (ArgumentParser): current parser
  43.  * - namespace (Namespace): namespace for output data
  44.  * - values (Array): parsed values
  45.  * - optionString (Array): input option string(not parsed)
  46.  *
  47.  * Call the action. Save result in namespace object
  48.  **/
  49. ActionAppend.prototype.call = function (parser, namespace, values) {
  50.   var items = (namespace[this.dest] || []).slice();
  51.   items.push(values);
  52.   namespace.set(this.dest, items);
  53. };
  54.  
downloadappend.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