Tandoori
Unarify is a function wrapper that returns a function, which when called with nothing, will with any arguments, will return an array of functions, where each function references one parameter of the original function
Installation:
$ npm install unarify
Why use it?
It can be used to keep referece to the original function while passing the other ones around. For example, you can have multiple race conditions, and use this to only invoke the function when all the race conditions have been satisfied.
It also allows for lazy(ish) evaluation, by saving parameters until the function needs to be called. It's not quite lazy... but it's close.
Usage:
const unarify = ;let a + b;let rest;let unaryAdd = ;Functionlet addFuncs = ;Function FunctionaddFuncs06;1 //Only 1 element is still not setaddFuncs17;0 //All elements are set;13 // 6 + 7Function Function //Returns the array of functions to set parameters even though//they've all been set. Equivalent to unaryAdd(false), unaryAdd(undefined), etc.//Does not work with rest parameters//Works with functions with mixed rest and normal//But only for the normal parameters.
Edits:
Github Repo to come soon