
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
Stringify an object to command line options
npm install --save opted
Opted is not a command line option parser. Rather, it is a library for stringifying an object into a list of command line arguments. E.g.
var opted = require('opted');
var args = opted({ foo: 'bar' });
console.log(args); // ['--foo', 'bar']
Options are kebab-cased and prefixed with '--'.
console.log( opted({ foo: 'bar' }) ); // ['--foo', 'bar']
console.log( opted({ fooBar: 'baz' }) ); // ['--foo-bar', 'baz']
Options that have single letter abbreviations can also be used.
console.log( opted({ f: 'bar' }) ); // ['-f', 'bar']
Options that are simple "on", but have no value, can be set to true. Setting a flag to false, will add 'no' to the beginning.
console.log( opted({ bananas: true }) ); // ['--bananas']
console.log( opted({ bananas: false }) ); // ['--no-bananas']
Options that include an equal sign will keep the equal sign.
console.log( opted({ 'name=', 'Andrew' }) ); // ['--name=Andrew']
Multiple options for a single flag can be passed in an array.
console.log( opted({ member: ['Bob', 'Larry'] }) ); // ['--member', 'Bob', '--member', 'Larry']
No problem. Just enable crazy-arg mode by passing true as the second parameter.
console.log( opted({ hello: 'world' }, true) ); // ['-hello', 'world']
Please see the contribution guidelines.
FAQs
Stringify an object to command line options
The npm package opted receives a total of 9,951 weekly downloads. As such, opted popularity was classified as popular.
We found that opted demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.