Permalink
Browse files

passing enum get test

  • Loading branch information...
1 parent 55f3c51 commit ff3afc585ad79d5736fe23944e9f3a25e423c0ba @substack committed Aug 9, 2011
Showing with 8 additions and 4 deletions.
  1. +7 −3 index.js
  2. +1 −1 test/scrub.js
View
@@ -213,9 +213,13 @@ var Scrubber = exports.Scrubber = function () {
}
function getAt (node, path) {
- path.forEach(function (key) {
- node = node[key];
- });
+ for (var i = 0; i < path.length; i++) {
+ var key = path[i];
+ if (Object.propertyIsEnumerable.call(node, key)) {
+ node = node[key];
+ }
+ else return undefined;
+ }
return node;
}
View
@@ -112,5 +112,5 @@ exports.enumGetLink = function () {
return function () {};
});
- assert.equal(args[0], 'doom');
+ assert.ok(args[0] === undefined);
};

0 comments on commit ff3afc5

Please sign in to comment.