{"_id":"split-cmd","_rev":"3-02933c3207f5cf5b058bf0b1599588d3","name":"split-cmd","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"split-cmd","version":"1.0.0","description":"💦Split a command into an array or an object","main":"index.js","dependencies":{},"devDependencies":{"jest":"^23.1.0"},"scripts":{"test":"jest"},"repository":{"type":"git","url":"git+https://github.com/thiagodp/split-cmd.git"},"keywords":["split","command","argument","args","cli","spawn","exec","process","child_process"],"author":{"name":"Thiago Delgado Pinto","email":"thiago-dp@bol.com.br"},"license":"MIT","bugs":{"url":"https://github.com/thiagodp/split-cmd/issues"},"homepage":"https://github.com/thiagodp/split-cmd#readme","gitHead":"6574da1c7d0f4d216d9d5897794fc14397ae41be","_id":"split-cmd@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"thiagodp","email":"thiago-dp@bol.com.br"},"dist":{"integrity":"sha512-swsF1ILoo7nnuua37fZXLfh5tk3FsIVhu7Temvg4qefMqgsi8OJsdyv15pMJ2gN04fT6WK8+XdU6fDIiFFezLg==","shasum":"9a5eabce3e580b22e599295b994d93e0739b6c6f","tarball":"https://registry.npmjs.org/split-cmd/-/split-cmd-1.0.0.tgz","fileCount":6,"unpackedSize":10088,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbHm8TCRA9TVsSAnZWagAAr+cP/3YzrMZ0507BvdGyQU3Z\nX7jcjI+q7JecGpFmoXNzVgdPDfqkXANj2HeOziVtMf8IvR/fXSLJDV2NIRXV\nqns46uapngFXgBmKhS5B9zD93XmPM/E1K2zezALyJ+jdV564mlqQRIywbfCE\nhS50TzqotrO35iOt463xrdpaOwoUPLS+XRptjmPLc3BED9oqFSzllMM0KBka\nFy+BSGgg688QFNIxRgxIF7nhWy03i1vDea/BIfbI5nVg2R4fFvI9w9iO1oP9\n+cAEaC0PL0wsJSi7nzO6gEbyY/MbSTv3WzEtIwUj4M47Uf48rcAV5AAmWi4p\nCHq+owb/gu9NeRg1yh6yv3CS4b8KrcW1Za8bWpmW6d+uLykaDokDWXzHVcJW\nfwJWdgGYGdbPAM1Qs6fn6UFOam4DVOFMsMeqCpOOdWfi+p0RB67kYLHn5ZDu\nI8y1Skw8nm+D9/vADLMOVdhslOFiFiKiP9Y3CC6qyvQqtq4/rgTjciYUmYYt\nLEz5QHBFA20K9PJYbGcduUbsHmfo+DpHjptzKNCSNDJdgoq6zxTnykPiz/Nr\nYG0dchPl3zRdtOy2v91iR47DrM/VHTPA2iuYxmcqdRt7/p4g6+kMBXtbHovW\nIuzloWa8UQpt7ExPF3N7ZA3jBrqA+B7bGTjjV9opx5UEcd7XRgxmBtWVJKXJ\nEDq+\r\n=epCn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGB5pw5nS+FZoD0W6odigK+/XHRPeeqhxu/ssFLVmjVyAiEAjHJofOUuA9h2h9VYZFKMIjq3QRRrLMIUiLg/hzcqvLY="}]},"maintainers":[{"name":"thiagodp","email":"thiago-dp@bol.com.br"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/split-cmd_1.0.0_1528721170472_0.5891538448028608"},"_hasShrinkwrap":false},"1.0.1":{"name":"split-cmd","version":"1.0.1","description":"💦Split a command into an array or an object","main":"index.js","dependencies":{},"devDependencies":{"jest":"^25.1.0"},"scripts":{"test":"jest"},"repository":{"type":"git","url":"git+https://github.com/thiagodp/split-cmd.git"},"keywords":["split","command","argument","args","cli","spawn","exec","process","child_process"],"author":{"name":"Thiago Delgado Pinto","email":"thiago-dp@bol.com.br"},"license":"MIT","bugs":{"url":"https://github.com/thiagodp/split-cmd/issues"},"homepage":"https://github.com/thiagodp/split-cmd#readme","gitHead":"99c3b146602c56b484646f4de104e7c7f3786c92","_id":"split-cmd@1.0.1","_nodeVersion":"12.14.0","_npmVersion":"6.10.1","dist":{"integrity":"sha512-HnyUFgtv7yNcGKK1+tO1O2eyXwEVnXqQzjshvroHsCu4M9fxS8lJ3bpW9XfD8YG0SdxW6hXNHdT/VFAxtNY1yw==","shasum":"ea1dd50bf1acf0b0d388243ba406ff202e123239","tarball":"https://registry.npmjs.org/split-cmd/-/split-cmd-1.0.1.tgz","fileCount":6,"unpackedSize":10085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeKKACCRA9TVsSAnZWagAAIokP/j1DdpIcaMKvKgO9CONC\nbqIyv0/6P+P0Jkk0LvoOEzMIAPTCegd6NkQi43Lgxueo96hVPQyqT7KwnTyb\nGpsJERzbUF65hz1tbRWzdZKc81StFIDMMq82cID5qT1Si8m8PtYEnabAimv5\nd00G5EffcagJrwT8C8BVFR81ZAB0BvFUuyHyrXbQ87tVG543hAeqQh/T/Lhf\nP3uP/upID5OewP5Iqa3h07fqsifz0pYmcQjVONbxvBAUu9+4RzUYrlxQshGP\nux61uHVvZPG4T5N9+0Z4TEiSOe9rla7bYFS9l6dmVL4RMDgULNWUp8LXw8rC\nkaJK79Zsbf+MNnDwK6QXDx5VTv2t6biP0TTrOzIm6Z+L/jErEiaaKFxvMfdv\nD2mmcrySdBe550UZgSRbDkna3a6yYdW4AgVpd7ox4o/ct4+YA+iHwtmckOsu\n16El9YGjqc+gaEy3lFDpNIm8MPhsfc6zNAr6DZXtuIjonxJljKt6vYhTgkEq\nFRfykyCwr1WoYh5F3njz4BK45Vk9UaDxKIXDRRpeXFs/ASm3fcnaJB3fc0gd\ni9u2KoU2WIzR7L6x88PE06+whh4aviAcHUFdD5LcIuinmjAOry0HcZUi3mxN\nmJmswRvmR/tApGSryWpUGSx8QZt93YFqTmDVgUsL27I6oeQigRFYAPcWmd5b\npoDM\r\n=AFCB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF3saFA6J26lJGFjXU9+mZfSbDgOWGpmLrZwDRE89J4jAiEAxD0AXfcxVLYNsfdm6h6U3xiejSoRHttw7zYyXgZs/QE="}]},"maintainers":[{"name":"thiagodp","email":"thiago-dp@bol.com.br"}],"_npmUser":{"name":"thiagodp","email":"thiago-dp@bol.com.br"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/split-cmd_1.0.1_1579720706062_0.21045624023629306"},"_hasShrinkwrap":false},"1.1.0":{"name":"split-cmd","version":"1.1.0","description":"💦Split a command into an array or an object","license":"MIT","homepage":"https://github.com/thiagodp/split-cmd#readme","bugs":{"url":"https://github.com/thiagodp/split-cmd/issues"},"source":"index.ts","main":"index.js","browser":"index.umd.js","unpkg":"index.umd.js","module":"index.esm.js","types":"index.d.ts","scripts":{"test":"jest","build":"microbundle --no-sourcemap","all":"pnpm run test && pnpm run build","preversion":"jest && pnpm run build","postversion":"echo \"Don't forget to push the tags and publish the version.\""},"dependencies":{},"devDependencies":{"jest":"^29.7.0","microbundle":"^0.15.1"},"keywords":["split","command","argument","args","cli","spawn","exec","process","child_process"],"repository":{"type":"git","url":"git+https://github.com/thiagodp/split-cmd.git"},"author":{"name":"Thiago Delgado Pinto","email":"thiago_dp@yahoo.com.br"},"gitHead":"89ca818dc86351f114ac2e67502ec51fd72fd016","_id":"split-cmd@1.1.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-WhWthSU0kpuxXPbm3QW/QGS+B7ngFb+E1SGXccrUO/ZBcwnG0zuHk1E8v0UJ9HfyDi46k8wZ3dcl5gwa4c2v8g==","shasum":"14b0608c54246acbfc9b2ad8fbe18ed480ad0ceb","tarball":"https://registry.npmjs.org/split-cmd/-/split-cmd-1.1.0.tgz","fileCount":9,"unpackedSize":9541,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXiAu0TvTtLPd+xmeLvrY6E/BWbMID6cvw5aLPT3XX+wIhAKr3VS7Glf23+4XT7pc/yr0p2CxLk8iRU8azYm90y+0N"}]},"_npmUser":{"name":"thiagodp","email":"thiago_dp@yahoo.com.br"},"directories":{},"maintainers":[{"name":"thiagodp","email":"thiago_dp@yahoo.com.br"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/split-cmd_1.1.0_1703124075132_0.13232372784388047"},"_hasShrinkwrap":false}},"time":{"created":"2018-06-11T12:46:10.472Z","1.0.0":"2018-06-11T12:46:10.529Z","modified":"2023-12-21T02:01:15.580Z","1.0.1":"2020-01-22T19:18:26.255Z","1.1.0":"2023-12-21T02:01:15.343Z"},"maintainers":[{"name":"thiagodp","email":"thiago_dp@yahoo.com.br"}],"description":"💦Split a command into an array or an object","homepage":"https://github.com/thiagodp/split-cmd#readme","keywords":["split","command","argument","args","cli","spawn","exec","process","child_process"],"repository":{"type":"git","url":"git+https://github.com/thiagodp/split-cmd.git"},"author":{"name":"Thiago Delgado Pinto","email":"thiago_dp@yahoo.com.br"},"bugs":{"url":"https://github.com/thiagodp/split-cmd/issues"},"license":"MIT","readme":"[![npm (tag)](https://img.shields.io/npm/v/split-cmd?color=green&label=NPM&style=for-the-badge)](https://github.com/thiagodp/split-cmd/releases)\r\n[![Build Status](https://img.shields.io/github/actions/workflow/status/thiagodp/split-cmd/test.yml?style=for-the-badge)](https://github.com/thiagodp/split-cmd/actions)\r\n[![License](https://img.shields.io/npm/l/split-cmd.svg?style=for-the-badge&color=green)](https://github.com/thiagodp/split-cmd/blob/master/LICENSE.txt)\r\n[![npm](https://img.shields.io/npm/dt/split-cmd?style=for-the-badge&color=green)](https://www.npmjs.com/package/split-cmd)\r\n\r\n# split-cmd\r\n\r\n> 💦 Split a command into an array or an object\r\n\r\nUseful for splitting a command to use with NodeJS' [child process](https://nodejs.org/api/child_process.html) methods, like [spawn](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options), [exec](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback), and [execFile](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback), as well with libs like [execa](https://github.com/sindresorhus/execa).\r\n\r\n⚡ Just 0.4 KB uncompressed, no external dependencies.\r\n\r\n🎯 Version `1.1`+ works with NodeJS, DenoJS and browsers. JavaScript and TypeScript.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm i split-cmd\r\n```\r\n\r\n## Usage\r\n\r\n### Splitting into an array\r\n\r\n```js\r\nimport { split } from 'split-cmd';\r\n\r\nconst arr = split( 'git commit -m \"some message with spaces\"' );\r\n\r\nconsole.log( arr ); // [ \"git\", \"commit\", \"-m\", \"some message with spaces\" ]\r\n```\r\n\r\n### Splitting into an object\r\n\r\n```js\r\nimport { splitToObject } from 'split-cmd';\r\n\r\nconst obj = splitToObject( 'git commit -m \"some message with spaces\"' );\r\n\r\nconsole.log( obj.command ); // git\r\nconsole.log( obj.args ); // [ \"commit\", \"-m\", \"some message with spaces\" ]\r\n```\r\n\r\n### Using it with execa\r\n\r\n```js\r\nimport { splitToObject } from 'split-cmd';\r\nimport { execa } from 'execa';\r\n\r\n// Executing a single command\r\nconst obj = splitToObject( 'echo \"I see unicorns\"' );\r\nexeca( obj.command, obj.args )\r\n    .then( result => console.log( result.stdout ) ) // I see unicorns\r\n    .catch( error => console.log( error ) );\r\n\r\n// Executing multiple commands in batch\r\n[\r\n    'echo \"I see unicorns\"',\r\n    'mkdir foo',\r\n    'touch foo/bar.txt'\r\n]\r\n.map( s => splitToObject( s ) )\r\n.forEach( obj => {\r\n    execa( obj.command, obj.args )\r\n        .then( result => console.log( result.stdout ) )\r\n        .catch( error => console.log( error ) );\r\n} );\r\n```\r\n\r\n## API\r\n\r\n```js\r\n/**\r\n * Split a command into an array.\r\n *\r\n * @param {string} command Command to split.\r\n * @returns {Array}\r\n */\r\nsplit( command: string ): string[]\r\n\r\n/**\r\n * Split a command into an object with the attributes `command` and `args`.\r\n *\r\n *\r\n * @param {string} command Command to split.\r\n * @returns {object}\r\n */\r\nsplitToObject( command: string ): { command?: string, args?: string[] }\r\n```\r\n\r\n## License\r\n\r\nMIT © [Thiago Delgado Pinto](https://github.com/thiagodp)\r\n","readmeFilename":"README.md"}