1.2.0 • Published 7 years ago

reopt v1.2.0

Weekly downloads
236
License
ISC
Repository
github
Last release
7 years ago

reopt

Build status NPM version Downloads Dependency Status

Test coverage

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

License

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

9 years ago

1.0.0

9 years ago