# angular-template-expressions-extractor

> Turns Angular templates into a list of expressions

Latest version **0.0.4** (published 2023-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-template-expressions-extractor
pnpm add angular-template-expressions-extractor
yarn add angular-template-expressions-extractor
bun add angular-template-expressions-extractor
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-04-03 |
| First published | 2023-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hans Otto Wirtz |
| Maintainers | hansottowirtz |

## Links

- npm: https://www.npmjs.com/package/angular-template-expressions-extractor
- Repository: https://github.com/hansottowirtz/angular-template-expressions-extractor
- Homepage: https://github.com/hansottowirtz/angular-template-expressions-extractor#readme
- Issues: https://github.com/hansottowirtz/angular-template-expressions-extractor/issues
- npm.io page: https://npm.io/package/angular-template-expressions-extractor

## Dependencies (5)

- [tap](https://npm.io/package/tap.md) ^16.3.4
- [astring](https://npm.io/package/astring.md) ^1.8.4
- [reserved-words](https://npm.io/package/reserved-words.md) ^0.1.2
- [angular-html-parser](https://npm.io/package/angular-html-parser.md) ^4.0.1
- [angular-estree-parser](https://npm.io/package/angular-estree-parser.md) ^6.2.0

## Recent versions

- 0.0.4 (latest) — 2023-04-03
- 0.0.3 — 2023-04-01
- 0.0.2 — 2023-04-01
- 0.0.1 — 2023-04-01

## README

# 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](https://formatjs.io/docs/getting-started/message-extraction/).

See [test/expressions.test.ts](test/expressions.test.ts) for examples.

| Input      | Output       |
|------------|--------------|
| `{{ 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)` |

---
_Source: https://npm.io/package/angular-template-expressions-extractor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
