UNPKG

1.53 kBSource Map (JSON)View Raw
1{"version":3,"file":"bind.js","sourceRoot":"","sources":["src/bind.ts"],"names":[],"mappings":";;AAAA,kCAAqC;AAErC,qCAAuF;AACvF,6CAA+C;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,IAAI,GAAG,0BAAgB,CAAC,uBAAuB,CAC1D,IAAI,yBAAe,CAAC,IAAI,EAAE,IAAI,4BAAc,EAAE,EAAE;IAC9C,cAAc,EAAE,IAAI;CACrB,CAAC,CAC6B,CAAC;AACjB,eALJ,YAAI,CAKI;AACrB,kBAAe,YAAI,CAAC","sourcesContent":["import bind = require('lodash/bind');\n\nimport { DecoratorConfig, DecoratorFactory, BiTypedMethodDecorator1 } from './factory';\nimport { BindApplicator } from './applicators';\n\n/**\n * Creates a function that invokes func with the this binding of thisArg and partials prepended to the arguments it receives.\n *\n * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for partially applied arguments.\n *\n * Note: Unlike native Function#bind, this method doesn't set the \"length\" property of bound functions.\n * @param {...*} [partials] The argument to be partially applied.\n * @example\n *\n * class MyClass {\n * @Bind()\n * bound() {\n * return this;\n * }\n *\n * unbound() {\n * return this;\n * }\n * }\n *\n * const myClass = new MyClass();\n *\n * myClass.bound.call(null); // => myClass {}\n * myClass.unbound.call(null); // => null\n */\nexport const Bind = DecoratorFactory.createInstanceDecorator(\n new DecoratorConfig(bind, new BindApplicator(), {\n optionalParams: true\n })\n) as BiTypedMethodDecorator1<any>;\nexport { Bind as bind, };\nexport default Bind;\n"]}
\No newline at end of file