antv-l7/node_modules/minimist-options
thinkinggis f7e5376b7d fix(fix css): fix css png 2019-11-22 18:04:14 +08:00
..
index.js fix(fix css): fix css png 2019-11-22 18:04:14 +08:00
license fix(fix css): fix css png 2019-11-22 18:04:14 +08:00
package.json fix(fix css): fix css png 2019-11-22 18:04:14 +08:00
readme.md fix(fix css): fix css png 2019-11-22 18:04:14 +08:00

readme.md

minimist-options Build Status

Write options for minimist in a comfortable way.

Installation

$ npm install --save minimist-options

Usage

const buildOptions = require('minimist-options');
const minimist = require('minimist');

const options = buildOptions({
	name: {
		type: 'string',
		alias: 'n',
		default: 'john'
	},

	force: {
		type: 'boolean',
		alias: ['f', 'o'],
		default: false
	},

	published: 'boolean',

	// special option for positional arguments (`_` in minimist)
	arguments: 'string'
});

const args = minimist(options);

instead of:

const minimist = require('minimist');

const options = {
	string: ['name', '_'],
	boolean: ['force', 'published'],
	alias: {
		n: 'name',
		f: 'force',
		o: 'force'
	},
	default: {
		name: 'john',
		f: false
	}
};

const args = minimist(options);

License

MIT © Vadim Demedes