https://github.com/prettier/angular-estree-parser
A parser that converts Angular source code into an ESTree-compatible form
https://github.com/prettier/angular-estree-parser
Last synced: 2 months ago
JSON representation
A parser that converts Angular source code into an ESTree-compatible form
- Host: GitHub
- URL: https://github.com/prettier/angular-estree-parser
- Owner: prettier
- License: mit
- Created: 2018-10-18T10:42:13.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T15:00:58.000Z (7 months ago)
- Last Synced: 2024-10-29T15:15:06.243Z (7 months ago)
- Language: TypeScript
- Size: 5.32 MB
- Stars: 16
- Watchers: 9
- Forks: 11
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# angular-estree-parser
[![Build Status][github_actions_badge]][github_actions_link]
[![Coverage][coverage_badge]][coverage_link]
[![Npm Version][package_version_badge]][package_link]
[![MIT License][license_badge]][license_link][github_actions_badge]: https://img.shields.io/github/actions/workflow/status/prettier/angular-estree-parser/ci.yml
[github_actions_link]: https://github.com/prettier/angular-estree-parser/actions?query=workflow%3ACI+branch%3Amain
[coverage_badge]: https://img.shields.io/codecov/c/github/prettier/angular-estree-parser/main.svg
[coverage_link]: https://codecov.io/gh/prettier/angular-estree-parser
[license_badge]: https://img.shields.io/npm/l/angular-estree-parser.svg
[license_link]: https://github.com/prettier/angular-estree-parser/blob/main/LICENSE
[package_version_badge]: https://img.shields.io/npm/v/angular-estree-parser.svg
[package_link]: https://www.npmjs.com/package/angular-estree-parserA parser that converts Angular source code into an ESTree-compatible form
[Changelog](https://github.com/prettier/angular-estree-parser/blob/main/CHANGELOG.md)
## Install
```sh
# using npm
npm install --save angular-estree-parser @angular/compiler# using yarn
yarn add angular-estree-parser @angular/compiler
```## Usage
```js
import * as ngEstreeParser from 'angular-estree-parser';const ast = ngEstreeParser.parseBinding('a | b:c');
//=> { type: "NGPipeExpression", ... }
```## API
- `parseAction(input: string): AST` for `(target)="input"`
- `parseBinding(input: string): AST` for `[target]="input"`
- `parseInterpolationExpression(input: string): AST` for `{{input}}`
- `parseTemplateBindings(input: string): AST` for `*directive="input"`## Development
```sh
# lint
yarn run lint# build
yarn run build# test
yarn run test
```## License
MIT © [Ika](https://github.com/ikatyang)