Yank Down
Have you ever been unsure what value to pass first?
const divide = numerator => denominator => numerator/denominator;
but later found to your horror that it would have been better the other way around?
const needToBeDividedBy3 = [1,3,4,5,2];
const wrongAnswer = needToBeDivided.map(divide(3));
Well then, say hello to yankDown.
import { yankDown } from 'yank-down';
const flippedDivide = yankDown(divide)(1);
const correctAnswer = needToBeDivided.map(flippedDivide(3));
AMAZING!!!
Multi-Parameter Functions
Yank Down will even work with multi-parameter functions.
const factoryFactory =
(factoryName, factoryConfig = {}) =>
(objProps = {}) =>
{ ...objProps, factoryConfig, type: factoryName }
const flippedFF = yankDown(factoryFactory)(1);
SO CONVENIENT~~~~
Arbitrary Curry Depth
As you would expect, yankDown can work with curried functions of arbitrary depth
const makeArray = one => two => three => [one, two, three];
console.log(makeArray(1)(2)(3));
const yankedMakeArray = yankDown(makeArray)(1);
console.log(yankedMakeArray(1)(2)(3));
JUST WOW.