loose-envify

WebJar for loose-envify

License

License

MIT
GroupId

GroupId

org.webjars.bowergithub.zertosh
ArtifactId

ArtifactId

loose-envify
Last Version

Last Version

1.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

loose-envify
WebJar for loose-envify
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/zertosh/loose-envify

Download loose-envify

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.zertosh/loose-envify/ -->
<dependency>
    <groupId>org.webjars.bowergithub.zertosh</groupId>
    <artifactId>loose-envify</artifactId>
    <version>1.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.zertosh/loose-envify/
implementation 'org.webjars.bowergithub.zertosh:loose-envify:1.4.0'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.zertosh/loose-envify/
implementation ("org.webjars.bowergithub.zertosh:loose-envify:1.4.0")
'org.webjars.bowergithub.zertosh:loose-envify:jar:1.4.0'
<dependency org="org.webjars.bowergithub.zertosh" name="loose-envify" rev="1.4.0">
  <artifact name="loose-envify" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.zertosh', module='loose-envify', version='1.4.0')
)
libraryDependencies += "org.webjars.bowergithub.zertosh" % "loose-envify" % "1.4.0"
[org.webjars.bowergithub.zertosh/loose-envify "1.4.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bowergithub.lydell : js-tokens jar [3.0.0,4),[4.0.0,5)

Project Modules

There are no modules declared in this project.

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

Versions

Version
1.4.0
1.3.1
1.3.0