2.0.1 • Published 6 years ago
babel-identifiers v2.0.1
babel-identifiers
Classify Babel identifiers
Installation
yarn add babel-identifiersUsage
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"