diff --git a/js-lib/jsDump.js b/js-lib/jsDump.js index 05b90f7..af1c7d9 100644 --- a/js-lib/jsDump.js +++ b/js-lib/jsDump.js @@ -39,6 +39,10 @@ var jsDump; var reName = /^function (\w+)/; jsDump = { + doParse:function(obj) { + this.alreadySeenObjects = []; + return this.parse(obj); + }, parse:function( obj, type ){//type is used mostly internally, you can fix a (custom)type in advance var parser = this.parsers[ type || this.typeOf(obj) ]; type = typeof parser; @@ -146,7 +150,7 @@ var jsDump; if (!this.ignoreFunctions || this.typeOf(map[key]) != 'function') { var value = "<< LOOP >>"; - if (this.alreadySeenObjects.indexOf(map[key]) == -1) { + if ((typeof map[key] != 'object') || this.alreadySeenObjects.indexOf(map[key]) == -1) { this.alreadySeenObjects.push(map[key]); value = this.parse(map[key]); } diff --git a/lib/jasmine/template_writer.rb b/lib/jasmine/template_writer.rb index 83242c7..2ba834e 100644 --- a/lib/jasmine/template_writer.rb +++ b/lib/jasmine/template_writer.rb @@ -40,11 +40,11 @@ module Jasmine } catch (e) {} if (usejsDump) { - var dump = jsDump.parse(data); + var dump = jsDump.doParse(data); if (dump.indexOf("\\n") == -1) { JHW.log(dump); } else { - JHW.log("jsDump: " + jsDump.parse(data)); + JHW.log("jsDump: " + dump); } } }