node/tools/node_modules/babel-eslint/node_modules/loose-envify
Michaël Zasso b043a70201 tools: add babel-eslint
Create tools/update-babel-eslint.sh script and execute it to do the
first installation of the package.
Update tools/license-builder.sh and execute it to add babel-eslint's
license to our LICENSE file.

PR-URL: https://github.com/nodejs/node/pull/17820
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2018-01-11 09:50:47 +01:00
..
cli.js tools: add babel-eslint 2018-01-11 09:50:47 +01:00
custom.js tools: add babel-eslint 2018-01-11 09:50:47 +01:00
index.js tools: add babel-eslint 2018-01-11 09:50:47 +01:00
LICENSE tools: add babel-eslint 2018-01-11 09:50:47 +01:00
loose-envify.js tools: add babel-eslint 2018-01-11 09:50:47 +01:00
package.json tools: add babel-eslint 2018-01-11 09:50:47 +01:00
README.md tools: add babel-eslint 2018-01-11 09:50:47 +01:00
replace.js tools: add babel-eslint 2018-01-11 09:50:47 +01:00

loose-envify

Build Status

Fast (and loose) selective process.env replacer using js-tokens instead of an AST. Works just like envify but much faster.

Gotchas

  • Doesn't handle broken syntax.
  • Doesn't look inside embedded expressions in template strings.
    • this won't work:
    console.log(`the current env is ${process.env.NODE_ENV}`);
    
  • Doesn't replace oddly-spaced or oddly-commented expressions.
    • this won't work:
    console.log(process./*won't*/env./*work*/NODE_ENV);
    

Usage/Options

loose-envify has the exact same interface as envify, including the CLI.

Benchmark

envify:

  $ for i in {1..5}; do node bench/bench.js 'envify'; done
  708ms
  727ms
  791ms
  719ms
  720ms

loose-envify:

  $ for i in {1..5}; do node bench/bench.js '../'; done
  51ms
  52ms
  52ms
  52ms
  52ms