1.0.1 • Published 7 years ago

provejs-params v1.0.1

Weekly downloads
33
License
MIT
Repository
github
Last release
7 years ago

provejs-params

Prove function parameters using a simple schema.

Install

npm install provejs-params --save

Usage

var Prove = require('provejs-params');

function myFunction(myArray, myNumber) {
	Prove('AN', arguments);
}

myFunction([], []); // bug here

will result in

{ Error: Argument #2: Expected `number` but got `array`
    at myFunction (/Users/dan/repos/.../test.js:122:2)
    at Object.<anonymous> (/Users/dan/repos/.../test.js:125:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3 code: 'EINVALIDTYPE' }

Supported Types

This work was inspired by: https://github.com/iarna/aproba