Comparing version
@@ -31,3 +31,3 @@ var fs = require('fs'); | ||
} | ||
var env_getter = filepath.indexOf('.env') !== -1 ? get_dot_env : require; | ||
var env_getter = filepath.indexOf('.env') !== -1 ? get_dot_env : get_JSON; | ||
var env = env_getter(filepath); | ||
@@ -81,2 +81,6 @@ Object.keys(env).forEach(function(k) { | ||
function get_JSON (path) { | ||
return JSON.parse(fs.readFileSync(path)) | ||
} | ||
function add_dot_env_line_to_json (json, env_variable) { | ||
@@ -83,0 +87,0 @@ var environment_parts = env_variable.replace('export','').split('='); |
{ | ||
"name": "env2", | ||
"version": "2.0.8", | ||
"version": "2.1.0", | ||
"description": "Environment Variable Loader", | ||
@@ -12,3 +12,5 @@ "keywords": [ | ||
"aws", | ||
"lambda" | ||
"lambda", | ||
"webpack", | ||
"universal" | ||
], | ||
@@ -15,0 +17,0 @@ "author": "Nelson <contact.nelsonic@gmail.com> (http://www.dwyl.io)", |
@@ -32,2 +32,11 @@ env2 - environment variable loader | ||
Works fine with build systems | ||
+like [webpack][webpack] and [browserify][browserify]. | ||
+If you want to use it on the frontend, | ||
+you will need some sort of [filesystem shim][brfs] | ||
+ | ||
+[webpack]: https://webpack.github.io/ | ||
+[browserify]: http://browserify.org/ | ||
+[brfs]: https://github.com/substack/brfs | ||
## How? | ||
@@ -34,0 +43,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
35928
1.15%239
1.27%175
5.42%33
-2.94%