Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-env-file

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-env-file - npm Package Compare versions

Comparing version 0.1.0 to 0.1.2

test/fixtures/.env.3

10

lib/index.js

@@ -75,8 +75,10 @@ 'user strict';

lines.forEach(function(line) {
if (!/\#/i.test(line)) { // ignore comment lines (starting with #).
var key_value = line.split(/\s*\=\s*/);
if (!/^\s*\#/i.test(line)) { // ignore comment lines (starting with #).
var key_value = line.match(/^([^=]+)\s*=\s*(.+)$/);
var env_key = key_value[0];
var env_value = key_value[1];
var env_key = key_value[1];
// remove ' and " characters if right side of = is quoted
var env_value = key_value[2].match(/^(['"]?)([^\n]*)\1$/m)[2];
// overwrite already defined `process.env.*` values?

@@ -83,0 +85,0 @@ if (!!options.overwrite) {

2

package.json

@@ -5,3 +5,3 @@ {

"keywords": ["process", "env", "file", "files", ".env", "ENV", "process.env", "parse", "load", "export", "exports"],
"version": "0.1.0",
"version": "0.1.2",
"homepage": "https://github.com/grimen/node-env-file",

@@ -8,0 +8,0 @@ "repository": {

@@ -136,1 +136,3 @@ # NODE-ENV-FILE [![Build Status](https://secure.travis-ci.org/grimen/node-env-file.png)](http://travis-ci.org/grimen/node-env-file)

Copyright (c) [Jonas Grimfelt](http://github.com/grimen)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/grimen/node-env-file/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

@@ -168,2 +168,18 @@ var helper = require('./helper'),

'("./fixtures/.env.3")': function () {
expect(function() {
env(__dirname + '/fixtures/.env.3');
}).to.not.throw(Error);
expect(process.env.FOO).to.be.equal('http://foo.com?bar=baz');
},
'("./fixtures/.env.4")': function () {
expect(function() {
env(__dirname + '/fixtures/.env.4');
}).to.not.throw(Error);
expect(process.env.FOO).to.be.equal('http://foo.com#hash?bar=baz');
},
'("./fixtures/.env.exports.0")': function () {

@@ -266,2 +282,10 @@ expect(function() {

expect(process.env.QUX).to.be.equal(undefined);
},
'("./fixtures/.env.exports.3")': function () {
expect(function() {
env(__dirname + '/fixtures/.env.exports.3');
}).to.not.throw(Error);
expect(process.env.FOO).to.be.equal('http://foo.com?bar=baz');
}

@@ -268,0 +292,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc