Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/to-flags
Convert the properties of an object to command line flags.
https://github.com/jonschlinkert/to-flags
Last synced: about 2 months ago
JSON representation
Convert the properties of an object to command line flags.
- Host: GitHub
- URL: https://github.com/jonschlinkert/to-flags
- Owner: jonschlinkert
- License: mit
- Created: 2015-06-13T10:27:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-07T21:31:48.000Z (about 9 years ago)
- Last Synced: 2024-07-26T17:55:37.767Z (about 2 months ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# to-flags [![NPM version](https://badge.fury.io/js/to-flags.svg)](http://badge.fury.io/js/to-flags)
> Convert the properties of an object to command line flags.
## Install
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i to-flags --save
```## Usage
```js
var toFlags = require('to-flags');
```## API
**Params**
* `obj` **{Object}**
* `keys` **{Array}**
* `returns` **{Array}**: Array of args**Example**
```js
var options = {
foo: 'bar',
abc: true,
xyz: 10,
one: false
};// create command line args for all options
toFlags(options);
//=> ['--foo=bar', '--abc', '--xyz=10', '--no-one']// or specific options
toFlags(options, ['foo', 'abc']);
//=> ['--foo=bar', '--abc']
```## Related projects
* [minimist-plugins](https://github.com/jonschlinkert/minimist-plugins): Simple wrapper to make minimist pluggable. ~20 sloc.
* [minimist-events](https://github.com/jonschlinkert/minimist-events): Add events to minimist, ~30 sloc.
* [minimist-methods](https://github.com/jonschlinkert/minimist-methods): Map your node.js application's methods to command line arguments.
* [minimist-expand](https://github.com/jonschlinkert/minimist-expand): Expand minimist args with expand-object.
* [to-flag](https://github.com/jonschlinkert/to-flag): Create a command-line argument from a string or string (key) and value.## Running tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/to-flags/issues/new)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)## License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 07, 2015._