Classify Babel identifiers
yarn add babel-identifiers
Identifier nodes fall into one of three kinds:
- "binding" -
let binding = ...
- "reference" -
reference;
- "static" -
a.static
And into one of four grammars:
- "javascript" -
let javascript = ...
- "jsx" -
<jsx/>
- "flow" -
({}: flow)
- "typescript" -
enum typescript {}
import {getIdentifierKind, getIdentifierGrammar} from 'babel-identifiers';
isIdentifierLike(path); // true | false
getIdentifierKind(path); // "binding" | "reference" | "static"
getIdentifierGrammar(path); // "javascript" | "flow" | "typescript"