| 223 | }; |
| 224 | |
| 225 | function profileMethodNamed(name: string): MethodDecorator { |
| 226 | return (target, key, descriptor: PropertyDescriptor) => { |
| 227 | // save a reference to the original method this way we keep the values currently in the |
| 228 | // descriptor and don't overwrite what another decorator might have done to the descriptor. |
| 229 | if (descriptor === undefined) { |
| 230 | descriptor = Object.getOwnPropertyDescriptor(target, key); |
| 231 | } |
| 232 | const originalMethod = descriptor.value; |
| 233 | |
| 234 | //editing the descriptor/value parameter |
| 235 | descriptor.value = profileFunctionFactory(originalMethod, name); |
| 236 | |
| 237 | // return edited descriptor as opposed to overwriting the descriptor |
| 238 | return descriptor; |
| 239 | }; |
| 240 | } |
| 241 | |
| 242 | const voidMethodDecorator = () => { |
| 243 | // no op |