Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

scrub example

  • Loading branch information...
commit ec1fb18b494f1bcb6b1ce4a2a86dce6560ae746d 1 parent 1148bc7
@substack authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 examples/scrub.js
View
10 examples/scrub.js
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.