MCPcopy
hub / github.com/loopbackio/loopback-next / defineMetadata

Method defineMetadata

packages/metadata/src/reflect.ts:27–39  ·  view source on GitHub ↗

* define metadata for a target class or it's property/method

(
    metadataKey: string,
    metadataValue: any,
    target: Object,
    propertyKey?: string,
  )

Source from the content-addressed store, hash-verified

25 * define metadata for a target class or it's property/method
26 */
27 defineMetadata(
28 metadataKey: string,
29 metadataValue: any,
30 target: Object,
31 propertyKey?: string,
32 ) {
33 metadataKey = this.getMetadataKey(metadataKey);
34 if (propertyKey) {
35 Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);
36 } else {
37 Reflect.defineMetadata(metadataKey, metadataValue, target);
38 }
39 }
40
41 /**
42 * lookup metadata from a target object and its prototype chain

Callers 10

getJsonSchemaFunction · 0.45
getModelMetadataMethod · 0.45
metadata.unit.tsFile · 0.45
decorateMethod · 0.45
mergeWithInheritedMethod · 0.45
mergeWithOwnMethod · 0.45
runTestsFunction · 0.45
getControllerSpecFunction · 0.45

Calls 1

getMetadataKeyMethod · 0.95

Tested by 1

runTestsFunction · 0.36