Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/yargs-parser/README.md

    r59329aa re29cc2e  
    11# yargs-parser
    22
    3 ![ci](https://github.com/yargs/yargs-parser/workflows/ci/badge.svg)
     3[![Build Status](https://travis-ci.org/yargs/yargs-parser.svg)](https://travis-ci.org/yargs/yargs-parser)
     4[![Coverage Status](https://coveralls.io/repos/yargs/yargs-parser/badge.svg?branch=)](https://coveralls.io/r/yargs/yargs-parser?branch=master)
    45[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser)
    5 [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
    6 ![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/yargs-parser)
     6[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
     7
    78
    89The mighty option parser used by [yargs](https://github.com/yargs/yargs).
     
    1011visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.
    1112
    12 <img width="250" src="https://raw.githubusercontent.com/yargs/yargs-parser/main/yargs-logo.png">
     13<img width="250" src="https://raw.githubusercontent.com/yargs/yargs-parser/master/yargs-logo.png">
    1314
    1415## Example
     
    1920
    2021```js
    21 const argv = require('yargs-parser')(process.argv.slice(2))
     22var argv = require('yargs-parser')(process.argv.slice(2))
    2223console.log(argv)
    2324```
    2425
    25 ```console
    26 $ node example.js --foo=33 --bar hello
     26```sh
     27node example.js --foo=33 --bar hello
    2728{ _: [], foo: 33, bar: 'hello' }
    2829```
     
    3132
    3233```js
    33 const argv = require('yargs-parser')('--foo=99 --bar=33')
     34var argv = require('./')('--foo=99 --bar=33')
    3435console.log(argv)
    3536```
    3637
    37 ```console
     38```sh
    3839{ _: [], foo: 99, bar: 33 }
    3940```
     
    4243
    4344```js
    44 const parse = require('yargs-parser')
     45var parse = require('yargs-parser')
    4546parse(['-f', 11, '--zoom', 55].join(' '))   // <-- array to string
    4647parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
    4748```
    4849
    49 ## Deno Example
    50 
    51 As of `v19` `yargs-parser` supports [Deno](https://github.com/denoland/deno):
    52 
    53 ```typescript
    54 import parser from "https://deno.land/x/yargs_parser/deno.ts";
    55 
    56 const argv = parser('--foo=99 --bar=9987930', {
    57   string: ['bar']
    58 })
    59 console.log(argv)
    60 ```
    61 
    62 ## ESM Example
    63 
    64 As of `v19` `yargs-parser` supports ESM (_both in Node.js and in the browser_):
    65 
    66 **Node.js:**
    67 
    68 ```js
    69 import parser from 'yargs-parser'
    70 
    71 const argv = parser('--foo=99 --bar=9987930', {
    72   string: ['bar']
    73 })
    74 console.log(argv)
    75 ```
    76 
    77 **Browsers:**
    78 
    79 ```html
    80 <!doctype html>
    81 <body>
    82   <script type="module">
    83     import parser from "https://unpkg.com/yargs-parser@19.0.0/browser.js";
    84 
    85     const argv = parser('--foo=99 --bar=9987930', {
    86       string: ['bar']
    87     })
    88     console.log(argv)
    89   </script>
    90 </body>
    91 ```
    92 
    9350## API
    9451
    95 ### parser(args, opts={})
     52### require('yargs-parser')(args, opts={})
    9653
    9754Parses command line arguments returning a simple mapping of keys and values.
     
    143100  * `key/value`: key value pairs for each argument and their aliases.
    144101  * `_`: an array representing the positional arguments.
    145   * [optional] `--`:  an array with arguments after the end-of-options flag `--`.
    146102* `error`: populated with an error object if an exception occurred during parsing.
    147103* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.
    148 * `newAliases`: any new aliases added via camel-case expansion:
    149   * `boolean`: `{ fooBar: true }`
    150 * `defaulted`: any new argument created by `opts.default`, no aliases included.
    151   * `boolean`: `{ foo: true }`
    152 * `configuration`: given by default settings and `opts.configuration`.
     104* `newAliases`: any new aliases added via camel-case expansion.
     105* `configuration`: the configuration loaded from the `yargs` stanza in package.json.
    153106
    154107<a name="configuration"></a>
     
    175128Should a group of short-options be treated as boolean flags?
    176129
    177 ```console
    178 $ node example.js -abc
     130```sh
     131node example.js -abc
    179132{ _: [], a: true, b: true, c: true }
    180133```
     
    182135_if disabled:_
    183136
    184 ```console
    185 $ node example.js -abc
     137```sh
     138node example.js -abc
    186139{ _: [], abc: true }
    187140```
     
    194147Should hyphenated arguments be expanded into camel-case aliases?
    195148
    196 ```console
    197 $ node example.js --foo-bar
     149```sh
     150node example.js --foo-bar
    198151{ _: [], 'foo-bar': true, fooBar: true }
    199152```
     
    201154_if disabled:_
    202155
    203 ```console
    204 $ node example.js --foo-bar
     156```sh
     157node example.js --foo-bar
    205158{ _: [], 'foo-bar': true }
    206159```
     
    213166Should keys that contain `.` be treated as objects?
    214167
    215 ```console
    216 $ node example.js --foo.bar
     168```sh
     169node example.js --foo.bar
    217170{ _: [], foo: { bar: true } }
    218171```
     
    220173_if disabled:_
    221174
    222 ```console
    223 $ node example.js --foo.bar
     175```sh
     176node example.js --foo.bar
    224177{ _: [], "foo.bar": true }
    225178```
     
    232185Should keys that look like numbers be treated as such?
    233186
    234 ```console
    235 $ node example.js --foo=99.3
     187```sh
     188node example.js --foo=99.3
    236189{ _: [], foo: 99.3 }
    237190```
     
    239192_if disabled:_
    240193
    241 ```console
    242 $ node example.js --foo=99.3
     194```sh
     195node example.js --foo=99.3
    243196{ _: [], foo: "99.3" }
    244197```
    245198
    246 ### parse positional numbers
    247 
    248 * default: `true`
    249 * key: `parse-positional-numbers`
    250 
    251 Should positional keys that look like numbers be treated as such.
    252 
    253 ```console
    254 $ node example.js 99.3
    255 { _: [99.3] }
    256 ```
    257 
    258 _if disabled:_
    259 
    260 ```console
    261 $ node example.js 99.3
    262 { _: ['99.3'] }
    263 ```
    264 
    265199### boolean negation
    266200
     
    270204Should variables prefixed with `--no` be treated as negations?
    271205
    272 ```console
    273 $ node example.js --no-foo
     206```sh
     207node example.js --no-foo
    274208{ _: [], foo: false }
    275209```
     
    277211_if disabled:_
    278212
    279 ```console
    280 $ node example.js --no-foo
     213```sh
     214node example.js --no-foo
    281215{ _: [], "no-foo": true }
    282216```
     
    297231Should arguments be coerced into an array when duplicated:
    298232
    299 ```console
    300 $ node example.js -x 1 -x 2
     233```sh
     234node example.js -x 1 -x 2
    301235{ _: [], x: [1, 2] }
    302236```
     
    304238_if disabled:_
    305239
    306 ```console
    307 $ node example.js -x 1 -x 2
     240```sh
     241node example.js -x 1 -x 2
    308242{ _: [], x: 2 }
    309243```
     
    316250Should array arguments be coerced into a single array when duplicated:
    317251
    318 ```console
    319 $ node example.js -x 1 2 -x 3 4
     252```sh
     253node example.js -x 1 2 -x 3 4
    320254{ _: [], x: [1, 2, 3, 4] }
    321255```
     
    323257_if disabled:_
    324258
    325 ```console
    326 $ node example.js -x 1 2 -x 3 4
     259```sh
     260node example.js -x 1 2 -x 3 4
    327261{ _: [], x: [[1, 2], [3, 4]] }
    328262```
    329 
    330 ### greedy arrays
    331 
    332 * default: `true`
    333 * key: `greedy-arrays`
    334 
    335 Should arrays consume more than one positional argument following their flag.
    336 
    337 ```console
    338 $ node example --arr 1 2
    339 { _: [], arr: [1, 2] }
    340 ```
    341 
    342 _if disabled:_
    343 
    344 ```console
    345 $ node example --arr 1 2
    346 { _: [2], arr: [1] }
    347 ```
    348 
    349 **Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.**
    350 
    351 ### nargs eats options
    352 
    353 * default: `false`
    354 * key: `nargs-eats-options`
    355 
    356 Should nargs consume dash options as well as positional arguments.
    357263
    358264### negation prefix
     
    363269The prefix to use for negated boolean variables.
    364270
    365 ```console
    366 $ node example.js --no-foo
     271```sh
     272node example.js --no-foo
    367273{ _: [], foo: false }
    368274```
     
    370276_if set to `quux`:_
    371277
    372 ```console
    373 $ node example.js --quuxfoo
     278```sh
     279node example.js --quuxfoo
    374280{ _: [], foo: false }
    375281```
     
    384290_If disabled:_
    385291
    386 ```console
    387 $ node example.js a -b -- x y
     292```sh
     293node example.js a -b -- x y
    388294{ _: [ 'a', 'x', 'y' ], b: true }
    389295```
     
    391297_If enabled:_
    392298
    393 ```console
    394 $ node example.js a -b -- x y
     299```sh
     300node example.js a -b -- x y
    395301{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }
    396302```
     
    405311_If disabled:_
    406312
    407 ```console
    408 $ node example.js -a 1 -c 2
     313```sh
     314node example.js -a 1 -c 2
    409315{ _: [], a: 1, c: 2 }
    410316```
     
    412318_If enabled:_
    413319
    414 ```console
    415 $ node example.js -a 1 -c 2
     320```sh
     321node example.js -a 1 -c 2
    416322{ _: [], a: 1, b: undefined, c: 2 }
    417323```
     
    426332_If disabled:_
    427333
    428 ```console
    429 $ node example.js -a run b -x y
     334```sh
     335node example.js -a run b -x y
    430336{ _: [ 'b' ], a: 'run', x: 'y' }
    431337```
     
    433339_If enabled:_
    434340
    435 ```console
    436 $ node example.js -a run b -x y
     341```sh
     342node example.js -a run b -x y
    437343{ _: [ 'b', '-x', 'y' ], a: 'run' }
    438344```
     
    447353_If disabled:_
    448354
    449 ```console
    450 $ node example.js --test-field 1
     355```sh
     356node example.js --test-field 1
    451357{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 }
    452358```
     
    454360_If enabled:_
    455361
    456 ```console
    457 $ node example.js --test-field 1
     362```sh
     363node example.js --test-field 1
    458364{ _: [], 'test-field': 1, testField: 1 }
    459365```
     
    465371
    466372Should dashed keys be removed before returning results?  This option has no effect if
    467 `camel-case-expansion` is disabled.
    468 
    469 _If disabled:_
    470 
    471 ```console
    472 $ node example.js --test-field 1
     373`camel-case-exansion` is disabled.
     374
     375_If disabled:_
     376
     377```sh
     378node example.js --test-field 1
    473379{ _: [], 'test-field': 1, testField: 1 }
    474380```
     
    476382_If enabled:_
    477383
    478 ```console
    479 $ node example.js --test-field 1
     384```sh
     385node example.js --test-field 1
    480386{ _: [], testField: 1 }
    481387```
    482 
    483 ### unknown options as args
    484 
    485 * default: `false`
    486 * key: `unknown-options-as-args`
    487 
    488 Should unknown options be treated like regular arguments?  An unknown option is one that is not
    489 configured in `opts`.
    490 
    491 _If disabled_
    492 
    493 ```console
    494 $ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
    495 { _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true }
    496 ```
    497 
    498 _If enabled_
    499 
    500 ```console
    501 $ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
    502 { _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' }
    503 ```
    504 
    505 ## Supported Node.js Versions
    506 
    507 Libraries in this ecosystem make a best effort to track
    508 [Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
    509 post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
    510388
    511389## Special Thanks
Note: See TracChangeset for help on using the changeset viewer.