summaryrefslogblamecommitdiff
path: root/node_modules/sucrase/dist/util/getIdentifierNames.js
blob: c0195cae243814ef6940d0b879f15d9ad5d395f0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                         
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _types = require('../parser/tokenizer/types');

/**
 * Get all identifier names in the code, in order, including duplicates.
 */
 function getIdentifierNames(code, tokens) {
  const names = [];
  for (const token of tokens) {
    if (token.type === _types.TokenType.name) {
      names.push(code.slice(token.start, token.end));
    }
  }
  return names;
} exports.default = getIdentifierNames;