Permalink
Browse files

no need to manually cast property lookups in JS; they are always a st…

…ring anyway
  • Loading branch information...
1 parent 4628cc8 commit 03e37e69cb77b4ae564b8d86014f0ba88835ab86 @nateps nateps committed Oct 28, 2012
Showing with 2 additions and 11 deletions.
  1. +2 −11 lib/tree.js
View
@@ -11,18 +11,9 @@ function traverse (tree, path, iter) {
, parent
;
while (prop = props.shift()) {
- currPath += (currPath ? '.' + prop : prop);
+ currPath = currPath ? currPath + '.' + prop : prop;
parent = curr;
- if (Array.isArray(curr)) {
- if (prop === 'length') {
- curr = curr.length;
- } else {
- prop = parseInt(prop, 10);
- curr = curr[prop];
- }
- } else {
- curr = curr[prop];
- }
+ curr = curr[prop];
// parts can be modified by iter(...)
next = iter(curr, currPath, props, parent);

0 comments on commit 03e37e6

Please sign in to comment.