{"name":"tiny-parse-argv","repository":{"type":"git","url":"git+https://github.com/fabiospampinato/tiny-parse-argv.git"},"description":"A tiny function for parsing process.argv, a modern rewrite of a sensible subset of minimist.","version":"2.0.1","type":"module","main":"dist/index.js","exports":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","test":"tsex test","test:watch":"tsex test --watch","prepublishOnly":"npm run clean && npm run compile && npm run test"},"keywords":["tiny","parse","argv"],"devDependencies":{"fava":"^0.0.8","tsex":"^1.1.5","typescript":"^4.9.5"},"gitHead":"d7ab53c2464f2e2ecdc0db495d4197e818226b1c","bugs":{"url":"https://github.com/fabiospampinato/tiny-parse-argv/issues"},"homepage":"https://github.com/fabiospampinato/tiny-parse-argv#readme","_id":"tiny-parse-argv@2.0.1","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-UbDGAxca3BOKYr4E8uefvaNM37LkprpSpCqFQCUPiHjgkf97sWe71AJePWAwcpyJwQsSOao6zx98sWTTz9MDyg==","shasum":"d37ce4f6904c48131092b42bde0afad957036a0a","tarball":"http://registry-npm.ywwl.com/tiny-parse-argv/download/tiny-parse-argv-2.0.1.tgz","fileCount":15,"unpackedSize":35012,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGiX7cHACHuPYaSgXA2zjhdEzFcIUaWyQrYF2jZcFOJLAiEAlxAkFneT2BNGzUz5zFN7GIBrPJmUcJIbju4DiTSG+j4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj42mBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq1TQ/7B8u+pvDbXdZpXFdYhEBWti9bcUy+/3hy1WyJUbf3w+teXTEQ\r\nh2HJxB2SWtUqv/Ae3lNxQSFwHGDL4G6GgYFhBE96uCTbKjTaJYFqqEdbBT2K\r\ndNpMTHjByXDL8xTk4Uqxlmu+o2v3qlzxGM4yqHH6gEzgqF3RZmzMT9HvIJvm\r\n9bZY+Zw6huEC9M4dFyBoFwDTrCXWtgC+hnvGiA27l+IIOXjDXhHoH5xg3OjZ\r\nYwEjM0pHJpQX0wiQ58DRiQl4u5rbQw3+7nd4LwuHPOKoLuzXKBzfgEarJB3U\r\nchCwHzWPcQUymbq2mcgpJwuN+UPZnJIb2b3+0lKNJXe2tQ7mak5PkxdMEExu\r\nJgf5pFZMlYUrv6nssVGVjph3pcdTJ0eriXKkMm5yjIQ6X1Kk50Urr8A0MV4/\r\nwnXiBfwc8Zf7Q9hfp1UR8PxA+LhG6KDSx/OVUHSbijBLSl0/HlqEwnVsf2VJ\r\nQvuQuc1GWCVIltBtKuzrKisLxGG2m+N5ZRraysF3Af7mI8CE7oOyteSH4nJX\r\n/1kYlhL4YQ1h0DhpKcbqECZy67R+/WABTE4AOEIJ/q27XLQFgipMfgTrISpY\r\n+xlqGWxJNJOenAHZIRQw3MA40u8xFiJh2M5I0bG63Otozam3YaZJrSkycK76\r\nbIlLVUSOyFarohmitRSF+kkJJnhTv01DCPw=\r\n=TSY2\r\n-----END PGP SIGNATURE-----\r\n","size":8325,"noattachment":false,"key":"/tiny-parse-argv/-/tiny-parse-argv-2.0.1.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tiny-parse-argv_2.0.1_1675848065219_0.11315678121283579"},"_hasShrinkwrap":false,"readme":"# Tiny Parse Argv\n\nA tiny function for parsing `process.argv`, a modern rewrite of a sensible subset of [`minimist`](https://github.com/minimistjs/minimist).\n\n## Features\n\nThe following features are provided:\n\n- Built-in TypeScript types, and pretty clean and understandable code.\n- Single/multiple implicit/explicit shorthand flags: `-f`, `-f some`, `-f 123`, `-f123`, `-abc`, `-abc 123`, `-abc123`, `-f some -f other`.\n- Single/multiple implicit/explicit longhand flags: `--foo`, `--foo some`, `--foo 123`, `--foo=123`, `--foo=some`, `--foo some --foo other`.\n- Explicitly negated flags are `false` by default: `--no-foo`, `--no-bar`.\n- Eager flags consume multiple consecutive values: `-f one two three`, `--foo one two three`.\n- Arguments: `./app.sh with some list of arguments`.\n- Values that would be interpreted as numbers if they were JavaScript are coerced to numbers automatically.\n- Flags that could lead to prototype pollution issues are safely ignored.\n- `options.boolean`: the value for the listed flags will always be coerced to a boolean.\n- `options.string`: the value for the listed flags will always be coerced to a string.\n- `options.eager`: the listed flags are considered to be eager, and will consume multiple consecutive non-flag values.\n- `options.variadic`: the listed flags are considered to be variadic, and their value, if present, will always be an array.\n- `options.required`: the listed flags are considered to be required, if some are missing `options.onMissing` will be called.\n- `options.alias`: if any aliased flag is assigned then all the aliases for it will be assigned too, automatically.\n- `options.default`: an object containing default values, which will be used if not overridded by the `argv` array.\n- `options.incompatible`: an object mapping flags with other flags they are incompatible with.\n- `options.onIncompatible`: a function that will be called if any pairs of flags that are incompatible with each other is detected.\n- `options.onInvalid`: a function that will be called if any of the provided flags have an invalid value, e.g. a boolean value for a string flag.\n- `options.onMissing`: a function that will be called if any of the required flags is missing. If a default value is provided for a flag it won't be considered as missing.\n- `options.onUnknown`: a function that will be called if any of the flags are unknown, i.e. not listed as either a boolean, a string, or an alias. If a default value is provided for a flag it won't be considered as unknown.\n- `--`: a special flag that stops parsing, everything after it will be copied, untouched, into the `--` property of the return object.\n\n## Differences with `minimist`\n\nThe following differences exist compared to `minimist`:\n\n- `option['--']` set to `false` is not supported, it's as if it's always set to `true`.\n- `option.boolean` set to `true` is not supported, you should always explicitly list all your supported boolean flags instead.\n- `option.boolean` set to a single string is not supported, always provide an array of flags instead.\n- `option.string` set to a single string is not supported, always provide an array of flags instead.\n- `option.alias` mapping to a single string is not supported, always provide an array of aliases instead.\n- `option.stopEarly` is not supported, it's as if it's always set to `false`.\n- Dotted flags are not supported, so their paths will not be expanded, you can use [`path-prop`](https://github.com/fabiospampinato/path-prop)'s `unflat` function for that.\n\nOther than that it should work pretty much identically, since we are basically using the same tests.\n\n## Install\n\n```sh\nnpm install --save tiny-parse-argv\n```\n\n## Usage\n\n```ts\nimport parseArgv from 'tiny-parse-argv';\n\nparseArgv ([ '-f', '--foo', 'some', 'argument', '--', '--app-flag' ]);\n// => { f: true, foo: 'some', _: ['argument'], '--': ['--app-flag'] }\n```\n\n## License\n\nMIT © Fabio Spampinato\n","publish_time":1675848065475,"_cnpm_publish_time":1675848065475,"dist-tags":{"latest":"2.8.2"}}