Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 672 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 672 Bytes

babel-identifiers

Classify Babel identifiers

Installation

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 = ...
  2. "jsx" - <jsx/>
  3. "flow" - ({}: flow)
  4. "typescript" - enum typescript {}
import {getIdentifierKind, getIdentifierGrammar} from 'babel-identifiers';

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