reopt

1.2.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.0
    976
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.0
    976
  • 1.1.0
    3
  • 1.0.1
    4
  • 1.0.0
    2

Package Sidebar

Install

npm i reopt

Weekly Downloads

177

Version

1.2.0

License

ISC

Last publish

Collaborators

  • ftft1885