0.0.4 • Published 1 year ago

angular-template-expressions-extractor v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Angular Template Expressions Extractor

This module can be used to parse Angular templates and extract Javascript-compatible expressions from them, which can then be used for static analysis like extracting intl messages in formatjs.

See test/expressions.test.ts for examples.

InputOutput
{{ a + b }}a + b
<div [thing]="a + b" />a + b
<div *thing="1 \| async" />async(1)
<div *thing="a; else b" />a,"else",b
<div [thing]="a?.b?.c" />a?.b?.c
<div (thing)="action(1, 2)" />action(1, 2)
<option *ngFor="let country of countries \| keyvalue">"let","of",keyvalue(countries)