JSPM

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

Converts an object of options into an array of command-line arguments. Useful when calling command-line tools.

Package Exports

  • dargs

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 (dargs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dargs Build Status

Converts an object of options into an array of command-line arguments

Getting started

Install: npm install --save dargs

Example

var dargs = require('dargs');

var options = {
    foo: 'bar',
    hello: true,                    // results in only the key being used
    cake: false,                    // ignored
    camelCase: 5,                   // camelCase is slugged to `camel-case`
    multiple: ['value', 'value2'],  // converted to multiple arguments
    sad: ':('
};

var excludes = ['sad'];

console.log(dargs(options, excludes));

/*
[
    '--foo', 'bar',
    '--hello',
    '--camel-case', '5',
    '--multiple', 'value',
    '--multiple', 'value2'
]
*/

Documentation

options

Object of options to convert to command-line arguments.

excludes

Array of keys to exclude.

License

MIT License • © Sindre Sorhus