Mercurial
comparison third_party/bun/node_modules/loose-envify/README.md @ 12:de54585a40f1
Adding bun and node modules.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 02 Oct 2025 14:39:48 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 11:f33d9ff8b6e8 | 12:de54585a40f1 |
|---|---|
| 1 # loose-envify | |
| 2 | |
| 3 [](https://travis-ci.org/zertosh/loose-envify) | |
| 4 | |
| 5 Fast (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 | |
| 23 loose-envify has the exact same interface as [envify](https://github.com/hughsk/envify), including the CLI. | |
| 24 | |
| 25 ## Benchmark | |
| 26 | |
| 27 ``` | |
| 28 envify: | |
| 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 | |
| 37 loose-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 ``` |