UNPKG

1.57 kBSource Map (JSON)View Raw
1{"version":3,"file":"beforeAll.js","sourceRoot":"","sources":["src/beforeAll.ts"],"names":[],"mappings":";;AAAA,sCAAyC;AAEzC,qCAA+E;AAC/E,6CAAoD;AAEpD,IAAM,SAAS,GAAG,0BAAgB,CAAC,eAAe,CAChD,IAAI,yBAAe,CAAC,MAAM,EAAE,IAAI,iCAAmB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CACzE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,mBAA0B,CAAS;IACjC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAFD,8BAEC;AACqB,8BAAS;AAC/B,kBAAe,SAAS,CAAC","sourcesContent":["import before = require('lodash/before');\n\nimport { DecoratorConfig, DecoratorFactory, LodashDecorator } from './factory';\nimport { PostValueApplicator } from './applicators';\n\nconst decorator = DecoratorFactory.createDecorator(\n new DecoratorConfig(before, new PostValueApplicator(), { setter: true })\n);\n\n/**\n * Creates a function that invokes func, with the this binding and arguments of the created function, while it's called less than n times.\n * Subsequent calls to the created function return the result of the last func invocation.\n * @param {number} n The number of calls at whichc func is no longer invoked.\n * @example\n *\n * let calls = 0;\n *\n * class MyClass {\n * @BeforeAll(3)\n * fn() {\n * calls++;\n * }\n * }\n *\n * const myClass = new MyClass();\n * const myClass2 = new MyClass();\n *\n * myClass.fn();\n * myClass.fn();\n * myClass.fn();\n * myClass.fn();\n *\n * myClass2.fn();\n *\n * calls === 3; // => true\n */\nexport function BeforeAll(n: number): LodashDecorator {\n return decorator(n);\n}\nexport { BeforeAll as beforeAll };\nexport default decorator;\n"]}
\No newline at end of file