JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 158
  • Score
    100M100P100Q79154F
  • License ISC

get options from arguments with multiple overloads

Package Exports

  • reopt

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (reopt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

reopt

Build status [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][downloads-url] [![Dependency Status][david-image]][david-url] [npm-image]: https://img.shields.io/npm/v/reopt.svg?style=flat-square [npm-url]: https://npmjs.org/package/reopt [downloads-image]: http://img.shields.io/npm/dm/reopt.svg?style=flat-square [downloads-url]: https://npmjs.org/package/reopt [david-image]: http://img.shields.io/david/chunpu/reopt.svg?style=flat-square [david-url]: https://david-dm.org/chunpu/reopt

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