Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

assume underbar suffix for env prefix #11

Merged
merged 1 commit into from

2 participants

@gjohnson

When doing:

eson.env('GJ')

I assumed it would look for:

GJ_KEYNAME = "...";

If no prefix is there, obviously this would not be the case... Seem reasonable?

@tj tj merged commit 88d6f94 into from
@tj
Owner
tj commented

yup! thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 7, 2012
  1. assume underbar suffix for env plugin prefix

    Garrett Johnson authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +1 −0  lib/plugins/env.js
  2. +6 −0 test/env.js
View
1  lib/plugins/env.js
@@ -6,6 +6,7 @@
module.exports = function(prefix){
prefix = prefix || '';
+ if (prefix && /[^_]$/.test(prefix)) prefix += '_';
return function(key, val){
var name = prefix + key.toUpperCase().split(' ').join('_');
return process.env[name] || val;
View
6 test/env.js
@@ -20,4 +20,10 @@ describe('env(prefix)', function(){
process.env.NB_DEV_UI = 'yes';
fn('dev ui', 'no').should.equal('yes');
})
+
+ it('should append underbar', function(){
+ var fn = env('NB');
+ process.env.NB_DEV_UI = 'yes';
+ fn('dev ui', 'no').should.equal('yes');
+ });
})
Something went wrong with that request. Please try again.