{"_id":"to-arg","_rev":"44498","name":"to-arg","description":"Create a command-line argument from a string or string (key) and value.","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:13:41.000Z","created":"2015-02-13T07:28:24.265Z","1.1.0":"2015-04-17T20:08:24.996Z","1.0.0":"2015-02-13T07:28:24.265Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/to-arg.git"},"versions":{"1.1.0":{"name":"to-arg","description":"Create a command-line argument from a string or string (key) and value.","version":"1.1.0","homepage":"https://github.com/jonschlinkert/to-arg","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/to-arg.git"},"bugs":{"url":"https://github.com/jonschlinkert/to-arg/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/to-arg/blob/master/LICENSE"},"files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"dashify":"^0.1.0","is-primitive":"^2.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["arg","args","arguments","argv","bin","cli","cmd","command line","command-line","flag","flags","line","minimist","nopt","opt","opts","options"],"gitHead":"32195d3269fb6564f7efd665b7a6d0a9a332635f","_id":"to-arg@1.1.0","_shasum":"8a9ff0697c88c5d04986a1d8169d56cf69ecafcb","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"8a9ff0697c88c5d04986a1d8169d56cf69ecafcb","size":2492,"noattachment":false,"key":"/to-arg/-/to-arg-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-arg/download/to-arg-1.1.0.tgz"},"directories":{},"publish_time":1429301304996,"_cnpm_publish_time":1429301304996,"_hasShrinkwrap":false},"1.0.0":{"name":"to-arg","description":"Create a command-line argument from a string or string (key) and value.","version":"1.0.0","homepage":"https://github.com/jonschlinkert/to-arg","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/to-arg.git"},"bugs":{"url":"https://github.com/jonschlinkert/to-arg/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/to-arg/blob/master/LICENSE"},"files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"dashify":"^0.1.0","is-primitive":"^1.0.0"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["arg","args","arguments","argv","bin","cli","cmd","command line","command-line","flag","flags","line","minimist","nopt","opt","opts","options"],"gitHead":"b584e770854ba4c74353a838eea898f512f1e85c","_id":"to-arg@1.0.0","_shasum":"add65d94d06e6d888a85dd2dcb936950a7a6907b","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"add65d94d06e6d888a85dd2dcb936950a7a6907b","size":1671,"noattachment":false,"key":"/to-arg/-/to-arg-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/to-arg/download/to-arg-1.0.0.tgz"},"directories":{},"publish_time":1423812504265,"_cnpm_publish_time":1423812504265,"_hasShrinkwrap":false}},"readme":"# to-arg [![NPM version](https://badge.fury.io/js/to-arg.svg)](http://badge.fury.io/js/to-arg)  [![Build Status](https://travis-ci.org/jonschlinkert/to-arg.svg)](https://travis-ci.org/jonschlinkert/to-arg) \n\n> Create a command-line argument from a string or string (key) and value.\n\n## Install with [npm](npmjs.org)\n\n```bash\nnpm i to-arg --save\n```\n\n## Usage\n\n```js\nvar toArg = require('to-arg');\n\ntoArg('abc');\n//=> '--abc'\n\ntoArg('abc', true);\n//=> '--abc'\n\ntoArg('abc', 'xyz');\n//=> '--abc=xyz'\n\ntoArg('abc', 'true');\n//=> '--abc=true'\n\ntoArg('abc', 10);\n//=> '--abc=10'\n```\n\n**casing**\n\nKeys that are camelcase or contain spaces will be dash-cased:\n\n```js\ntoArg('fooBar');\n//=> '--foo-bar'\n\ntoArg('a b c');\n//=> '--a-b-c'\n\ntoArg('A');\n//=> '--a'\n```\n\n## Usage example\n\n```js\nvar obj = {\n  foo: 'bar',\n  abc: true,\n  xyz: 10,\n  one: false\n};\n\nvar args = Object.keys(obj).map(function (key) {\n  return toArg(key, obj[key]);\n});\n//=> ['--foo=bar', '--abc', '--xyz=10', '--no-one']\n```\n\n## Options\n\n### invert\n\nWhen the value is `false` an inverted flag is created by default:\n\n```js\ntoArg('a', false);\n//=> '--no-a'\n```\n\nTo disable inversion, pass `false` on the options:\n\n```js\ntoArg('a', false, {invert: false});\n//=> '--a'\n```\n\n## Other awesome libs\n * [option-cache](https://github.com/jonschlinkert/option-cache): Simple API for managing options in JavaScript applications.\n * [config-cache](https://github.com/jonschlinkert/config-cache): General purpose JavaScript object storage methods.\n\n## Run tests\nInstall dev dependencies:\n\n```bash\nnpm i -d && npm test\n```\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/to-arg/issues)\n\n## Author\n\n**Jon Schlinkert**\n\n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) \n\nThis was inspired by [grunt.option](https://github.com/gruntjs/grunt/blob/master/lib/grunt/option.js#L40).\n\n## License\nCopyright (c) 2015 Jon Schlinkert  \nReleased under the MIT license\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 17, 2015._\n","_attachments":{},"homepage":"https://github.com/jonschlinkert/to-arg","bugs":{"url":"https://github.com/jonschlinkert/to-arg/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/to-arg/blob/master/LICENSE"}}