Skip to content

Commit

Permalink
scrub example
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Jul 20, 2011
1 parent 1148bc7 commit ec1fb18
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/scrub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// scrub out circular references
var traverse = require('traverse');

var obj = { a : 1, b : 2, c : [ 3, 4 ] };
obj.c.push(obj);

var scrubbed = traverse(obj).map(function (x) {
if (this.circular) this.remove()
});
console.dir(scrubbed);

0 comments on commit ec1fb18

Please sign in to comment.