You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
353 B
TypeScript
13 lines
353 B
TypeScript
import memoizee from 'memoizee'
|
|
|
|
export function Memoize (config?: memoizee.Options<any>) {
|
|
return function (_target, _key, descriptor: PropertyDescriptor) {
|
|
const oldFunction = descriptor.value
|
|
const newFunction = memoizee(oldFunction, config)
|
|
|
|
descriptor.value = function () {
|
|
return newFunction.apply(this, arguments)
|
|
}
|
|
}
|
|
}
|