| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 2x 2x 1x 1x 1x 1x | /**
* Assigns the metadata to the class/function under specified `key`.
* This metadata can be reflected using `Reflector` class.
*/
export const ReflectMetadata = <K = any, V = any>(metadataKey: K, metadataValue: V) => (
target: object,
key?,
descriptor?,
) => {
if (descriptor) {
Reflect.defineMetadata(metadataKey, metadataValue, descriptor.value);
return descriptor;
}
Reflect.defineMetadata(metadataKey, metadataValue, target);
return target;
};
|