Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

constant.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. 'use strict';
  13. var util = require('util');
  14. var Action = require('../../action');
  15. /*:nodoc:*
  16. * new ActionAppendConstant(options)
  17. * - options (object): options hash see [[Action.new]]
  18. *
  19. **/
  20. var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {
  21. options = options || {};
  22. options.nargs = 0;
  23. if (typeof options.constant === 'undefined') {
  24. throw new Error('constant option is required for appendAction');
  25. }
  26. Action.call(this, options);
  27. };
  28. util.inherits(ActionAppendConstant, Action);
  29. /*:nodoc:*
  30. * ActionAppendConstant#call(parser, namespace, values, optionString) -> Void
  31. * - parser (ArgumentParser): current parser
  32. * - namespace (Namespace): namespace for output data
  33. * - values (Array): parsed values
  34. * - optionString (Array): input option string(not parsed)
  35. *
  36. * Call the action. Save result in namespace object
  37. **/
  38. ActionAppendConstant.prototype.call = function (parser, namespace) {
  39. var items = [].concat(namespace[this.dest] || []);
  40. items.push(this.constant);
  41. namespace.set(this.dest, items);
  42. };