| 202 | }; |
| 203 | |
| 204 | const profileStaticMethodUnnamed = <F extends Function>(ctor: F, key: symbol | string, descriptor) => { |
| 205 | // save a reference to the original method this way we keep the values currently in the |
| 206 | // descriptor and don't overwrite what another decorator might have done to the descriptor. |
| 207 | if (descriptor === undefined) { |
| 208 | descriptor = Object.getOwnPropertyDescriptor(ctor, key); |
| 209 | } |
| 210 | const originalMethod = descriptor.value; |
| 211 | |
| 212 | let className = ''; |
| 213 | if (ctor && ctor.name) { |
| 214 | className = ctor.name + '.'; |
| 215 | } |
| 216 | const name = className + key?.toString(); |
| 217 | |
| 218 | //editing the descriptor/value parameter |
| 219 | descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Static); |
| 220 | |
| 221 | // return edited descriptor as opposed to overwriting the descriptor |
| 222 | return descriptor; |
| 223 | }; |
| 224 | |
| 225 | function profileMethodNamed(name: string): MethodDecorator { |
| 226 | return (target, key, descriptor: PropertyDescriptor) => { |