lodash-decorators
Advanced tools
Comparing version 4.0.2 to 4.0.3
import { LodashMethodDecorator } from './factory'; | ||
/** | ||
* Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. | ||
* | ||
* @param {...*} [args] Additional arguments to invoke the function with | ||
* @example | ||
* | ||
* class MyClass { | ||
* value = 100; | ||
* | ||
* @Defer() | ||
* add(a) { | ||
* this.value += a; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.add(10); | ||
* | ||
* myClass.value; // => 100; | ||
* | ||
* setTimeout(() => { | ||
* myClass.value; // => 110; | ||
* }, 0); | ||
*/ | ||
export declare const Defer: (...args: any[]) => LodashMethodDecorator; | ||
export { Defer as defer }; | ||
export default Defer; |
25
defer.js
@@ -6,2 +6,27 @@ "use strict"; | ||
var applicators_1 = require("./applicators"); | ||
/** | ||
* Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. | ||
* | ||
* @param {...*} [args] Additional arguments to invoke the function with | ||
* @example | ||
* | ||
* class MyClass { | ||
* value = 100; | ||
* | ||
* @Defer() | ||
* add(a) { | ||
* this.value += a; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.add(10); | ||
* | ||
* myClass.value; // => 100; | ||
* | ||
* setTimeout(() => { | ||
* myClass.value; // => 110; | ||
* }, 0); | ||
*/ | ||
exports.Defer = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(lodash_1.defer, new applicators_1.InvokeApplicator(), { setter: true })); | ||
@@ -8,0 +33,0 @@ exports.defer = exports.Defer; |
import { LodashMethodDecorator } from './factory'; | ||
/** | ||
* Invokes func after wait milliseconds. Any additional arguments are provided to func when it's invoked. | ||
* | ||
* @param {number} wait The number of milliseconds to delay invocation. | ||
* @param {...*} [args] Additional arguments to invoke the function with | ||
* @example | ||
* | ||
* class MyClass { | ||
* value = 100; | ||
* | ||
* @Delay(20) | ||
* add(a) { | ||
* this.value += a; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.add(10); | ||
* | ||
* myClass.value; // => 100; | ||
* | ||
* setTimeout(() => { | ||
* myClass.value; // => 110; | ||
* }, 30); | ||
*/ | ||
export declare const Delay: (wait: number, ...args: any[]) => LodashMethodDecorator; | ||
export { Delay as delay }; | ||
export default Delay; |
26
delay.js
@@ -6,2 +6,28 @@ "use strict"; | ||
var applicators_1 = require("./applicators"); | ||
/** | ||
* Invokes func after wait milliseconds. Any additional arguments are provided to func when it's invoked. | ||
* | ||
* @param {number} wait The number of milliseconds to delay invocation. | ||
* @param {...*} [args] Additional arguments to invoke the function with | ||
* @example | ||
* | ||
* class MyClass { | ||
* value = 100; | ||
* | ||
* @Delay(20) | ||
* add(a) { | ||
* this.value += a; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.add(10); | ||
* | ||
* myClass.value; // => 100; | ||
* | ||
* setTimeout(() => { | ||
* myClass.value; // => 110; | ||
* }, 30); | ||
*/ | ||
exports.Delay = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(function (value, wait) { | ||
@@ -8,0 +34,0 @@ var args = []; |
import { LodashMethodDecorator } from './factory'; | ||
/** | ||
* Creates a function that invokes func with arguments reversed. Honestly, there is probably not much | ||
* use for this decorator but maybe you will find one? | ||
* | ||
* @example | ||
* | ||
* class MyClass { | ||
* value = 100; | ||
* | ||
* @Flip() | ||
* fn(a, b) { | ||
* return [ a, b ]; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.fn(10, 20); // => [ 20, 10 ] | ||
*/ | ||
export declare const Flip: () => LodashMethodDecorator; | ||
export { Flip as flip }; | ||
export default Flip; |
19
flip.js
@@ -6,2 +6,21 @@ "use strict"; | ||
var applicators_1 = require("./applicators"); | ||
/** | ||
* Creates a function that invokes func with arguments reversed. Honestly, there is probably not much | ||
* use for this decorator but maybe you will find one? | ||
* | ||
* @example | ||
* | ||
* class MyClass { | ||
* value = 100; | ||
* | ||
* @Flip() | ||
* fn(a, b) { | ||
* return [ a, b ]; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.fn(10, 20); // => [ 20, 10 ] | ||
*/ | ||
exports.Flip = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(lodash_1.flip, new applicators_1.PreValueApplicator())); | ||
@@ -8,0 +27,0 @@ exports.flip = exports.Flip; |
import { ResolvableFunction, LodashDecorator } from './factory'; | ||
/** | ||
* Creates a function that returns the result of invoking the given functions with the this binding of the created function, | ||
* where each successive invocation is supplied the return value of the previous. | ||
* | ||
* @example | ||
* | ||
* class MyClass { | ||
* name = 'Ted'; | ||
* | ||
* @Flow('getName', toUpperCase) | ||
* getUpperCaseName: () => string; | ||
* | ||
* getName() { | ||
* return this.name; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.getUpperCaseName(); // => 'TED' | ||
*/ | ||
export declare const Flow: (...fns: ResolvableFunction[]) => LodashDecorator; | ||
export { Flow as flow }; | ||
export default Flow; |
21
flow.js
@@ -6,2 +6,23 @@ "use strict"; | ||
var applicators_1 = require("./applicators"); | ||
/** | ||
* Creates a function that returns the result of invoking the given functions with the this binding of the created function, | ||
* where each successive invocation is supplied the return value of the previous. | ||
* | ||
* @example | ||
* | ||
* class MyClass { | ||
* name = 'Ted'; | ||
* | ||
* @Flow('getName', toUpperCase) | ||
* getUpperCaseName: () => string; | ||
* | ||
* getName() { | ||
* return this.name; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.getUpperCaseName(); // => 'TED' | ||
*/ | ||
exports.Flow = factory_1.DecoratorFactory.createInstanceDecorator(new factory_1.DecoratorConfig(lodash_1.flow, new applicators_1.ComposeApplicator({ post: true }), { property: true })); | ||
@@ -8,0 +29,0 @@ exports.flow = exports.Flow; |
import { LodashDecorator, ResolvableFunction } from './factory'; | ||
/** | ||
* Creates a function that returns the result of invoking the given functions with the this binding of the created function, | ||
* where each successive invocation is supplied the return value of the previous. | ||
* | ||
* @example | ||
* | ||
* class MyClass { | ||
* name = 'Ted'; | ||
* | ||
* @FlowRight(toUpperCase, 'getName') | ||
* getUpperCaseName: () => string; | ||
* | ||
* getName() { | ||
* return this.name; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.getUpperCaseName(); // => 'TED' | ||
*/ | ||
export declare const FlowRight: (...fns: ResolvableFunction[]) => LodashDecorator; | ||
export { FlowRight as flowRight }; | ||
export default FlowRight; |
@@ -6,2 +6,23 @@ "use strict"; | ||
var applicators_1 = require("./applicators"); | ||
/** | ||
* Creates a function that returns the result of invoking the given functions with the this binding of the created function, | ||
* where each successive invocation is supplied the return value of the previous. | ||
* | ||
* @example | ||
* | ||
* class MyClass { | ||
* name = 'Ted'; | ||
* | ||
* @FlowRight(toUpperCase, 'getName') | ||
* getUpperCaseName: () => string; | ||
* | ||
* getName() { | ||
* return this.name; | ||
* } | ||
* } | ||
* | ||
* const myClass = new MyClass(); | ||
* | ||
* myClass.getUpperCaseName(); // => 'TED' | ||
*/ | ||
exports.FlowRight = factory_1.DecoratorFactory.createInstanceDecorator(new factory_1.DecoratorConfig(lodash_1.flowRight, new applicators_1.ComposeApplicator({ post: false }), { property: true })); | ||
@@ -8,0 +29,0 @@ exports.flowRight = exports.FlowRight; |
@@ -5,3 +5,3 @@ { | ||
"description": "A collection of decorators using lodash at it's core.", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"engines": { | ||
@@ -8,0 +8,0 @@ "node": ">=0.12.0" |
@@ -1,4 +0,3 @@ | ||
import { LodashMethodDecorator } from './factory'; | ||
export declare const PartialRight: (...partials: any[]) => LodashMethodDecorator; | ||
export declare const PartialRight: (...partials: any[]) => PropertyDecorator; | ||
export { PartialRight as partialRight }; | ||
export default PartialRight; |
@@ -6,5 +6,5 @@ "use strict"; | ||
var applicators_1 = require("./applicators"); | ||
exports.PartialRight = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(lodash_1.partialRight, new applicators_1.PartialApplicator())); | ||
exports.PartialRight = factory_1.DecoratorFactory.createInstanceDecorator(new factory_1.DecoratorConfig(lodash_1.partialRight, new applicators_1.PartialApplicator(), { property: true, method: false })); | ||
exports.partialRight = exports.PartialRight; | ||
exports.default = exports.PartialRight; | ||
//# sourceMappingURL=partialRight.js.map |
@@ -11,2 +11,3 @@ # lodash-decorators | ||
- [Install](#install) | ||
@@ -31,4 +32,5 @@ - [Usage](#usage) | ||
- [No longer force instance decorator onto prototype](#no-longer-force-instance-decorator-onto-prototype) | ||
- [Curry is now an instance decorator](#curry-is-now-an-instance-decorator) | ||
- [All decorators now take arguments](#all-decorators-now-take-arguments) | ||
- [Removal of extensions and validation package](#removal-of-extensions-and-validation-package) | ||
- [Prototype decorator order no longer throws an error](#prototype-decorator-order-no-longer-throws-an-error) | ||
- [Other breaking changes](#other-breaking-changes) | ||
@@ -35,0 +37,0 @@ - [v4 Improvements](#v4-improvements) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
127674
2275
391