Wrappers is a small library exporting basic wrapper functions for functions.
Attach it to the short variable of choice:
var w = require'wrappers';
then get some cheap extra funcitonality out of your functions with standard wrappers:
var safeInit = wonceinit; // invokes wrapped init function at most oncevar tracedFn = wtracebuggyFn; // logs input and output when calledvar rateLimited = wthrottlecpuHeavyFn 200; // triggers at most every 200msvar burstTrigger = wrepeatwrepeatfire 5 50 3 1000; // bursts of 5 every second 3 times
Read the API.
This module used to be included in functional utility library interlude, but is now an extra.
$ npm install wrappers
MIT-Licensed. See LICENSE file for details.