JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12033
  • Score
    100M100P100Q128489F
  • License MIT

check arguments and if they wrong throw exeption

Package Exports

  • checkup

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 (checkup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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