UNPKG

1.8 kBSource Map (JSON)View Raw
1{"version":3,"file":"curry.js","sourceRoot":"","sources":["src/curry.ts"],"names":[],"mappings":";;AAAA,oCAAuC;AAEvC,qCAAuF;AACvF,6CAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACU,QAAA,KAAK,GAAG,0BAAgB,CAAC,uBAAuB,CAC3D,IAAI,yBAAe,CAAC,KAAK,EAAE,IAAI,gCAAkB,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CACzD,CAAC;AACnB,gBAHL,aAAK,CAGK;AACvB,kBAAe,aAAK,CAAC","sourcesContent":["import curry = require('lodash/curry');\n\nimport { DecoratorConfig, DecoratorFactory, BiTypedMethodDecorator1 } from './factory';\nimport { PreValueApplicator } from './applicators';\n\n/**\n * Creates a function that accepts arguments of func and either invokes func returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining func arguments, and so on.\n * The arity of func may be specified if func.length is not sufficient.\n * The original function is bound to the instance. If the method is needed to call in a different context use `CurryAll`.\n *\n * The _.curry.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for provided arguments.\n *\n * Note: This method doesn't set the \"length\" property of curried functions.\n * @param {number} [arity] The arity of func.\n * @example\n *\n * class MyClass {\n * multiplier = 2;\n *\n * @Curry()\n * add(a, b) {\n * return (a + b) * this.multiplier;\n * }\n * }\n *\n * const myClass = new MyClass();\n *\n * const add5 = myClass.add(5);\n *\n * add5AndMultiply(10); // => 30\n */\nexport const Curry = DecoratorFactory.createInstanceDecorator(\n new DecoratorConfig(curry, new PreValueApplicator(), { bound: true, optionalParams: true })\n) as BiTypedMethodDecorator1<number>;\nexport { Curry as curry };\nexport default Curry;\n"]}
\No newline at end of file