Permalink
Browse files

Changed object_stack behavior to avoid polluting it with unrelated va…

…lues
  • Loading branch information...
1 parent a586eec commit c10edec60974389a96cb93ed8ecad4b90083f7a3 @scottrabin committed May 27, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 prettyprint.js
View
@@ -21,7 +21,9 @@ exports.prettyprint = function( obj, depth, indent, blacklist, obj_stack ){
depth = ( isNaN( parseInt( depth ) ) ? exports.DEFAULT_DEPTH : depth );
indent = ( isNaN( parseInt( indent ) ) ? 0 : indent );
blacklist = ( blacklist instanceof Array ? blacklist : [] );
- obj_stack = ( obj_stack instanceof Array ? obj_stack : [] ).concat( obj );
+ obj_stack = ( obj_stack instanceof Array ? obj_stack.slice() : [] );
+
+ obj_stack.push( obj );
// get type
var type = retType( obj );

0 comments on commit c10edec

Please sign in to comment.