summaryrefslogtreecommitdiff
path: root/node_modules/babel-helper-evaluate-path/README.md
blob: 7f32eb10ea29c373a5ea8e0bd60e3554868daea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# babel-helper-evaluate-path

A wrapper for babel's `path.evaluate`

Fixes / Features:

+ Detect usages before initialization / declaration

```js
function foo() {
  console.log(b); // ReferenceError
  let b = 1;
}

function bar() {
  console.log(a); // a is void 0
  var a = 5;
  console.log(a); // 5
}
```

+ Detect usages in scopes outside of initialization for vars (hoisted)

```js
function foo() {
  if (a) var x = 5;
  console.log(x); // cannot determine
}
```

## Installation

```sh
npm install babel-helper-evaluate-path --save-dev
```