UNPKG

1.73 kBSource Map (JSON)View Raw
1{"version":3,"file":"curryAll.js","sourceRoot":"","sources":["src/curryAll.ts"],"names":[],"mappings":";;AAAA,oCAAuC;AAEvC,qCAAiF;AACjF,6CAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACU,QAAA,QAAQ,GAAG,0BAAgB,CAAC,eAAe,CACtD,IAAI,yBAAe,CAAC,KAAK,EAAE,IAAI,gCAAkB,EAAE,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAClD,CAAC;AACV,mBAHR,gBAAQ,CAGQ;AAC7B,kBAAe,gBAAQ,CAAC","sourcesContent":["import curry = require('lodash/curry');\n\nimport { DecoratorConfig, DecoratorFactory, BiTypedDecorator1 } 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 *\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 * Note: The original function invoked will not be called in the context of the instance. Use `Curry` to for using it bound.\n * @param {number} [arity] The arity of func.\n * @example\n *\n * class MyClass {\n * @CurryAll()\n * add(a, b) {\n * return (a + b);\n * }\n * }\n *\n * const myClass = new MyClass();\n *\n * const add5 = myClass.add(5);\n *\n * add5AndMultiply(10); // => 15\n */\nexport const CurryAll = DecoratorFactory.createDecorator(\n new DecoratorConfig(curry, new PreValueApplicator(), { optionalParams: true })\n) as BiTypedDecorator1<number>;\nexport { CurryAll as curryAll };\nexport default CurryAll;\n"]}
\No newline at end of file