optcheck

1.0.1 • Public • Published

optcheck

Checks requirements for and adds defaults to parameter objects

var optcheck = require('optcheck');

var args = {async: false, type: 'json'};
optcheck(args)
    .defaults({
        async: true,
        url: 'http://localhost'
    })
    .requires('type', 'url');
args.should.eql({async: false, type: 'json', url: 'http://localhost'});

API

optcheck({})

Takes a parameter object.

Returns an optcheck object to operate on the parameter object passed in.

.requires()

Checks the parameter object for properties.

Returns this.

.defaults({})

Adds properties from object to the parameter object if the parameter object needs the property.

Returns this.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i optcheck

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • matteckert