checkup

2018-10-23 admin

checkup是什么

什么是checkup,check arguments and if they wrong throw exeption

checkup使用教程帮助文档

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

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-43453.html

文章标题:checkup

回到顶部