| 180 | } |
| 181 | |
| 182 | const profileMethodUnnamed = (target: Object, key: symbol | string, descriptor) => { |
| 183 | // save a reference to the original method this way we keep the values currently in the |
| 184 | // descriptor and don't overwrite what another decorator might have done to the descriptor. |
| 185 | if (descriptor === undefined) { |
| 186 | descriptor = Object.getOwnPropertyDescriptor(target, key); |
| 187 | } |
| 188 | const originalMethod = descriptor.value; |
| 189 | |
| 190 | let className = ''; |
| 191 | if (target && target.constructor && target.constructor.name) { |
| 192 | className = target.constructor.name + '.'; |
| 193 | } |
| 194 | |
| 195 | const name = className + key?.toString(); |
| 196 | |
| 197 | //editing the descriptor/value parameter |
| 198 | descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Instance); |
| 199 | |
| 200 | // return edited descriptor as opposed to overwriting the descriptor |
| 201 | return descriptor; |
| 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 |