(originalFunction: any)
| 93 | } |
| 94 | |
| 95 | const memoize = (originalFunction: any) => { |
| 96 | const memoized = new WeakMap(); |
| 97 | return function (this: any, ...args: any[]): any { |
| 98 | if (!memoized.has(this)) { |
| 99 | memoized.set(this, originalFunction.apply(this, args)); |
| 100 | } |
| 101 | |
| 102 | return memoized.get(this); |
| 103 | }; |
| 104 | }; |
| 105 | |
| 106 | export class ExecutionError extends Error { |
| 107 | public name = "ExecutionError"; |