https://www.npmjs.com/package/lodash-decorators
lodash-decorators
npm install --save lodash lodash-decorators
import { Debounce } from 'lodash-decorators';
import Debounce from 'lodash-decorators/debounce';
import { Debounce, Memoize } from 'lodash-decorators';
class Person {
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
@Debounce(100)
save(date) {
return this.httpService.post(data);
}
@Memoize(item => item.id)
doSomeHeavyProcessing(arg1, arg2) {}
}
class Person {
@Memoize()
doSomething() {}
@Memoize
doSomething2() {}
@memoize()
doSomething3() {}
@memoize
doSomething4() {}
}