Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/babel-utils/babel-identifiers

Classify Babel identifiers
https://github.com/babel-utils/babel-identifiers

babel babel-util flow identifiers

Last synced: about 3 hours ago
JSON representation

Classify Babel identifiers

Awesome Lists containing this project

README

        

# babel-identifiers

> Classify Babel identifiers

### Installation

```sh
yarn add babel-identifiers
```

### Usage

Identifier nodes fall into one of three kinds:

1. "binding" - `let binding = ...`
2. "reference" - `reference;`
3. "static" - `a.static`

And into one of four grammars:

1. "javascript" - `let javascript = ...`
1. "jsx" - ``
2. "flow" - `({}: flow)`
3. "typescript" - `enum typescript {}`

```js
import {getIdentifierKind, getIdentifierGrammar} from 'babel-identifiers';

isIdentifierLike(path); // true | false
getIdentifierKind(path); // "binding" | "reference" | "static"
getIdentifierGrammar(path); // "javascript" | "flow" | "typescript"
```