Skip to content

Commit

Permalink
When using E4X objects as env variables, value would be returned as '…
Browse files Browse the repository at this point in the history
…xml' type object and incur in pretty-printing modifications (e.g. indentation). Fixed by converting value to string
  • Loading branch information
bard committed Sep 30, 2008
1 parent da940b6 commit 23e5d7c
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions seethrough.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,15 @@ seethrough.processors = {
// ----------------------------------------------------------------------

seethrough.getEnv = function(env, path) {
var value;
try {
value = path.split('.').reduce(function(subEnv, propName) subEnv[propName], env);
var value = path.split('.').reduce(function(subEnv, propName) subEnv[propName], env);
if(typeof(value) == 'xml' && value.nodeKind() == 'attribute')
return value.toString();
else
return value;
} catch(e if e.name == 'TypeError') {
value = undefined;
}

if(typeof(value) == 'function') {
// might be better to leave the choice of what to do to
// the requester. that will leave the burden too, though
return value(env);
return undefined;
}
else
return value;
};


Expand Down

0 comments on commit 23e5d7c

Please sign in to comment.