Skip to content

Commit

Permalink
use return values to auto-update
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Sep 4, 2010
1 parent 78edd30 commit bc68fa5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/traverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ function Traverse (refObj) {
state.notLeaf = !state.isLeaf;
state.notRoot = !state.isRoot;

f.call(state, node);
// use return values to update if defined
var ret = f.call(state, node);
if (ret !== undefined) state.update(ret);

if (typeof state.node == 'object'
&& state.node !== null && !state.circular) {
parents.push(state);
Expand Down

0 comments on commit bc68fa5

Please sign in to comment.