* 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, )
| 34 | * the directive metadata or from the associated decorator on the property. |
| 35 | */ |
| 36 | function 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 | } |
no test coverage detected