1.3.0 • Published 9 years ago

checkup v1.3.0

Weekly downloads
10,290
License
MIT
Repository
github
Last release
9 years ago

Checkup

Check arguments and if they wrong throw exeption.

Install

npm i chukup --save

How to use?

var check   = require('checkup');

function someFn(arg1, arg2, arg3) {
    check({
        arg1: arg1,
        arg2, arg2
        arg3: arg3
    });
}

function showName(name, callback) {
    check(arguments, ['name'])
    .check(arguments, ['callback'])
    .type('name', name, 'string')
    .type('callback', callback, 'function');

    console.log('every thing is ok:', name);
}

function callCallback(callback) {
    check([callback], ['callback'])
    .type('callback', callback, 'function');
    
    callback();
}

License

MIT