{"name":"dargs","version":"2.0.0","description":"Converts an object of options into an array of command-line arguments","repository":{"type":"git","url":"https://github.com/sindresorhus/dargs"},"keywords":["options","arguments","args","flags","cli"],"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"scripts":{"test":"mocha"},"devDependencies":{"mocha":"*"},"engines":{"node":">=0.10.0"},"license":"MIT","files":["index.js"],"gitHead":"26bf5e94ff78ebed3d2e8e2e20e0302a9ea7883e","bugs":{"url":"https://github.com/sindresorhus/dargs/issues"},"homepage":"https://github.com/sindresorhus/dargs","_id":"dargs@2.0.0","_shasum":"9fbfd26fa2cf7d9a7d07e33fc906f97e373ac36c","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"dist":{"shasum":"9fbfd26fa2cf7d9a7d07e33fc906f97e373ac36c","tarball":"http://registry-npm.ywwl.com/dargs/download/dargs-2.0.0.tgz","integrity":"sha512-j2gPsH+OVRW1IDk65iNyopOpRfBWYxMWlSW6fLDXKNh9/r1Z27P9ZMsXUuZ0wb7t/mCpk3Ts9xow9FbqmgHHmw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCX5PY4Mmvx6rIPuzzh9LFOjMUvtmQAaNcaJRdZppzHkQIga7ePjL0XHW986sgn1qrXhOvlgXG8pYE2wZwflsu/j8Q="}],"size":1223,"noattachment":false,"key":"/dargs/-/dargs-2.0.0.tgz"},"directories":{},"readme":"# dargs\n\n> Reverse [`minimist`](https://github.com/substack/minimist). Convert an object of options into an array of command-line arguments.\n\nUseful when spawning command-line tools.\n\n## Install\n\n```\n$ npm install dargs\n```\n\n## Usage\n\n```js\nimport dargs from 'dargs';\n\nconst object = {\n\t_: ['some', 'option'],          // Values in '_' will be appended to the end of the generated argument list\n\t'--': ['separated', 'option'],  // Values in '--' will be put at the very end of the argument list after the escape option (`--`)\n\tfoo: 'bar',\n\thello: true,                    // Results in only the key being used\n\tcake: false,                    // Prepends `no-` before the key\n\tcamelCase: 5,                   // CamelCase is slugged to `camel-case`\n\tmultiple: ['value', 'value2'],  // Converted to multiple arguments\n\tpieKind: 'cherry',\n\tsad: ':('\n};\n\nconst excludes = ['sad', /.*Kind$/];  // Excludes and includes accept regular expressions\nconst includes = ['camelCase', 'multiple', 'sad', /^pie.*/];\nconst aliases = {file: 'f'};\n\nconsole.log(dargs(object, {excludes}));\n/*\n[\n\t'--foo=bar',\n\t'--hello',\n\t'--no-cake',\n\t'--camel-case=5',\n\t'--multiple=value',\n\t'--multiple=value2',\n\t'some',\n\t'option',\n\t'--',\n\t'separated',\n\t'option'\n]\n*/\n\nconsole.log(dargs(object, {excludes, includes}));\n/*\n[\n\t'--camel-case=5',\n\t'--multiple=value',\n\t'--multiple=value2'\n]\n*/\n\n\nconsole.log(dargs(object, {includes}));\n/*\n[\n\t'--camel-case=5',\n\t'--multiple=value',\n\t'--multiple=value2',\n\t'--pie-kind=cherry',\n\t'--sad=:('\n]\n*/\n\n\nconsole.log(dargs({\n\tfoo: 'bar',\n\thello: true,\n\tfile: 'baz'\n}, {aliases}));\n/*\n[\n\t'--foo=bar',\n\t'--hello',\n\t'-f', 'baz'\n]\n*/\n```\n\n## API\n\n### dargs(object, options?)\n\n#### object\n\nType: `object`\n\nObject to convert to command-line arguments.\n\n#### options\n\nType: `object`\n\n##### excludes\n\nType: `Array<string | RegExp>`\n\nKeys or regex of keys to exclude. Takes precedence over `includes`.\n\n##### includes\n\nType: `Array<string | RegExp>`\n\nKeys or regex of keys to include.\n\n##### aliases\n\nType: `object`\n\nMaps keys in `object` to an aliased name. Matching keys are converted to arguments with a single dash (`-`) in front of the aliased key and the value in a separate array item. Keys are still affected by `includes` and `excludes`.\n\n##### useEquals\n\nType: `boolean`\\\nDefault: `true`\n\nSetting this to `false` makes it return the key and value as separate array items instead of using a `=` separator in one item. This can be useful for tools that doesn't support `--foo=bar` style flags.\n\n```js\nimport dargs from 'dargs';\n\nconsole.log(dargs({foo: 'bar'}, {useEquals: false}));\n/*\n[\n\t'--foo', 'bar'\n]\n*/\n```\n\n##### shortFlag\n\nType: `boolean`\\\nDefault: `true`\n\nMake a single character option key `{a: true}` become a short flag `-a` instead of `--a`.\n\n```js\nimport dargs from 'dargs';\n\nconsole.log(dargs({a: true}));\n//=> ['-a']\n\nconsole.log(dargs({a: true}, {shortFlag: false}));\n//=> ['--a']\n```\n\n##### ignoreTrue\n\nType: `boolean`\\\nDefault: `false`\n\nExclude `true` values. Can be useful when dealing with argument parsers that only expect negated arguments like `--no-foo`.\n\n##### ignoreFalse\n\nType: `boolean`\\\nDefault: `false`\n\nExclude `false` values. Can be useful when dealing with strict argument parsers that throw on unknown arguments like `--no-foo`.\n\n##### allowCamelCase\n\nType: `boolean`\\\nDefault: `false`\n\nBy default, camel-cased keys will be hyphenated. Enabling this will bypass the conversion process.\n\n```js\nimport dargs from 'dargs';\n\nconsole.log(dargs({fooBar: 'baz'}));\n//=> ['--foo-bar', 'baz']\n\nconsole.log(dargs({fooBar: 'baz'}, {allowCamelCase: true}));\n//=> ['--fooBar', 'baz']\n```\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-dargs?utm_source=npm-dargs&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n","publish_time":1408634963437,"_cnpm_publish_time":1408634963437,"dist-tags":{"latest":"8.1.0"}}