reopt

get options from arguments with multiple overloads

  • reopt

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
reopt
001.2.05 years ago7 years agoMinified + gzip package size for reopt in KB

Readme

reopt
!Build statustravis-imagetravis-url !NPM versionnpm-imagenpm-url !Downloadsdownloads-imagedownloads-url !Dependency Statusdavid-imagedavid-url
!Test coveragecoveralls-imagecoveralls-url
get options from arguments with multiple overloads

Installation

npm i reopt

Api

new Reopt(typeDefine, templates)

e.g.
new Reopt({
	param1: 'type1 type2'
	param2: 'type3'
}, ['param1', 'param1 param2'])

Usage

var Reopt = require('reopt')

var reopt = new Reopt({
	url: 'string',
	opt: 'object',
	callback: 'function'
}, [
	'url callback',
	'url',
	'opt callback',
	'opt'
])

function request() {
	var opt = reopt.get(arguments)
	console.log(opt)
}

request('http://some.server.com/', function() {})
/*
=> {
	url: 'http://some.server.com/',
	callback: function() {}
}
*/

License

!Licenselicense-imagelicense-url