1
0
Fork 0
peertube/server/core/helpers/memoize.ts

13 lines
353 B
TypeScript
Raw Normal View History

2023-01-09 04:29:23 -05:00
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)
}
}
}