MCPcopy Create free account
hub / github.com/angular/components / getBindingPropertyData

Function getBindingPropertyData

tools/dgeni/common/property-bindings.ts:36–69  ·  view source on GitHub ↗

* Method that detects the specified type of property binding (either "output" or "input") from * the directive metadata or from the associated decorator on the property.

(
  doc: PropertyMemberDoc,
  metadata: Map<string, any>,
  propertyName: string,
  decoratorName: string,
)

Source from the content-addressed store, hash-verified

34 * the directive metadata or from the associated decorator on the property.
35 */
36function getBindingPropertyData(
37 doc: PropertyMemberDoc,
38 metadata: Map<string, any>,
39 propertyName: string,
40 decoratorName: string,
41) {
42 if (metadata) {
43 const metadataValues: (string | {name: string; alias?: string})[] =
44 metadata.get(propertyName) || [];
45 const foundValue = metadataValues.find(value => {
46 const name = typeof value === 'string' ? value.split(':')[0] : value.name;
47 return name === doc.name;
48 });
49
50 if (foundValue) {
51 return {
52 name: doc.name,
53 alias:
54 typeof foundValue === 'string'
55 ? foundValue.split(':')[1]
56 : foundValue.alias || foundValue.name,
57 };
58 }
59 }
60
61 if (hasMemberDecorator(doc, decoratorName)) {
62 return {
63 name: doc.name,
64 alias: doc.decorators!.find(d => d.name == decoratorName)!.arguments![0],
65 };
66 }
67
68 return undefined;
69}

Callers 2

getInputBindingDataFunction · 0.85
getOutputBindingDataFunction · 0.85

Calls 2

hasMemberDecoratorFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected