UNPKG

1.07 kBMarkdownView Raw
1# loose-envify
2
3[![Build Status](https://travis-ci.org/zertosh/loose-envify.svg?branch=master)](https://travis-ci.org/zertosh/loose-envify)
4
5Fast (and loose) selective `process.env` replacer using [js-tokens](https://github.com/lydell/js-tokens) instead of an AST. Works just like [envify](https://github.com/hughsk/envify) but much faster.
6
7## Gotchas
8
9* Doesn't handle broken syntax.
10* Doesn't look inside embedded expressions in template strings.
11 - **this won't work:**
12 ```js
13 console.log(`the current env is ${process.env.NODE_ENV}`);
14 ```
15* Doesn't replace oddly-spaced or oddly-commented expressions.
16 - **this won't work:**
17 ```js
18 console.log(process./*won't*/env./*work*/NODE_ENV);
19 ```
20
21## Usage/Options
22
23loose-envify has the exact same interface as [envify](https://github.com/hughsk/envify), including the CLI.
24
25## Benchmark
26
27```
28envify:
29
30 $ for i in {1..5}; do node bench/bench.js 'envify'; done
31 708ms
32 727ms
33 791ms
34 719ms
35 720ms
36
37loose-envify:
38
39 $ for i in {1..5}; do node bench/bench.js '../'; done
40 51ms
41 52ms
42 52ms
43 52ms
44 52ms
45```
46
\No newline at end of file