Nary
Enforce function arity in JavaScript.
Installation
npm install nary --save
Usage
nullaryfn.length; //=> 0unaryfn.length; //=> 1binaryfn.length; //=> 2ternaryfn.length; //=> 3quaternaryfn.length; //=> 4nary5, fn.length; //=> 5 // This example fails because `parseInt` accepts an optional second argument as// the radix. This can wreak havoc in unexpected situations..mapparseInt; //=> [1, NaN, NaN, NaN, NaN] // Using `unary`, the function will only accept a single argument..mapunaryparseInt; //=> [1, 2, 3, 4, 5]
TypeScript
This project is written using TypeScript and publishes the definitions directly to NPM.
License
Apache 2.0