JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8103
  • Score
    100M100P100Q129649F
  • License MIT

Split argv(argument vector) and handle special cases, such as quoted values.

Package Exports

  • argv-split

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (argv-split) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

argv-split NPM version Build Status Dependency Status

Split argv(argument vector) and handle special cases, such as quoted values.

Why?

'--abc "a b c"'.split(' ');
// ['--abc', '"a', 'b', 'c"'] -> Oooooooooops!

Install

$ npm install argv-split --save

The usage is quite simple: split(argv)

var split = require('argv-split');

split('--abc "a b c"');
// ['--abc', 'a b c'], Oh yeah !!!!

split(string)

Splits a string, and balance quoted parts.

split('--abc "a \'b\' c"'); // ['--abc', "a 'b' c"]
split('--abc "a b c'); // ['--abc', '"a', 'b', 'c']

split.balance(array)

Balances an array and join incorrect splited parts.

split.balance(['--abc', '"a', 'b"']); // ['--abc', 'a b']

split.join(array, [quote='])

split.join(['--abc', 'a b']); // '--abc "a b"'

License

MIT