Skip to content
Browse files

More elegant way of retrieving value from path in getEnv.

  • Loading branch information...
1 parent da02042 commit da940b6e1db703c985455226608576a40a7241c4 @bard bard committed Oct 1, 2008
Showing with 2 additions and 8 deletions.
  1. +2 −8 seethrough.js
View
10 seethrough.js
@@ -165,15 +165,9 @@ seethrough.processors = {
// ----------------------------------------------------------------------
seethrough.getEnv = function(env, path) {
- var value = env;
-
- if(path.match(/\)$/))
- return getenv2(env, path);
-
+ var value;
try {
- for each(var step in path.split('.')) {
- value = value[step];
- }
+ value = path.split('.').reduce(function(subEnv, propName) subEnv[propName], env);
} catch(e if e.name == 'TypeError') {
value = undefined;
}

0 comments on commit da940b6

Please sign in to comment.
Something went wrong with that request. Please try again.