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.

readme.markdown 2.4KB

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # minimist
  2. parse argument options
  3. This module is the guts of optimist's argument parser without all the
  4. fanciful decoration.
  5. # example
  6. ``` js
  7. var argv = require('minimist')(process.argv.slice(2));
  8. console.log(argv);
  9. ```
  10. ```
  11. $ node example/parse.js -a beep -b boop
  12. { _: [], a: 'beep', b: 'boop' }
  13. ```
  14. ```
  15. $ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
  16. { _: [ 'foo', 'bar', 'baz' ],
  17. x: 3,
  18. y: 4,
  19. n: 5,
  20. a: true,
  21. b: true,
  22. c: true,
  23. beep: 'boop' }
  24. ```
  25. # security
  26. Previous versions had a prototype pollution bug that could cause privilege
  27. escalation in some circumstances when handling untrusted user input.
  28. Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764
  29. # methods
  30. ``` js
  31. var parseArgs = require('minimist')
  32. ```
  33. ## var argv = parseArgs(args, opts={})
  34. Return an argument object `argv` populated with the array arguments from `args`.
  35. `argv._` contains all the arguments that didn't have an option associated with
  36. them.
  37. Numeric-looking arguments will be returned as numbers unless `opts.string` or
  38. `opts.boolean` is set for that argument name.
  39. Any arguments after `'--'` will not be parsed and will end up in `argv._`.
  40. options can be:
  41. * `opts.string` - a string or array of strings argument names to always treat as
  42. strings
  43. * `opts.boolean` - a boolean, string or array of strings to always treat as
  44. booleans. if `true` will treat all double hyphenated arguments without equal signs
  45. as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
  46. * `opts.alias` - an object mapping string names to strings or arrays of string
  47. argument names to use as aliases
  48. * `opts.default` - an object mapping string argument names to default values
  49. * `opts.stopEarly` - when true, populate `argv._` with everything after the
  50. first non-option
  51. * `opts['--']` - when true, populate `argv._` with everything before the `--`
  52. and `argv['--']` with everything after the `--`. Here's an example:
  53. ```
  54. > require('./')('one two three -- four five --six'.split(' '), { '--': true })
  55. { _: [ 'one', 'two', 'three' ],
  56. '--': [ 'four', 'five', '--six' ] }
  57. ```
  58. Note that with `opts['--']` set, parsing for arguments still stops after the
  59. `--`.
  60. * `opts.unknown` - a function which is invoked with a command line parameter not
  61. defined in the `opts` configuration object. If the function returns `false`, the
  62. unknown option is not added to `argv`.
  63. # install
  64. With [npm](https://npmjs.org) do:
  65. ```
  66. npm install minimist
  67. ```
  68. # license
  69. MIT