1
0
Fork 0
peertube/server/core/helpers/memoize.ts
2023-10-04 15:13:25 +02:00

12 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)
}
}
}