source: node_modules/traverse/examples/scrub.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 253 bytes
RevLine 
[d24f17c]1'use strict';
2
3// scrub out circular references
4var traverse = require('traverse');
5
6var obj = { a: 1, b: 2, c: [3, 4] };
7obj.c.push(obj);
8
9var scrubbed = traverse(obj).map(function () {
10 if (this.circular) { this.remove(); }
11});
12console.dir(scrubbed);
Note: See TracBrowser for help on using the repository browser.