mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-10 15:04:45 +00:00
11 lines
242 B
JavaScript
11 lines
242 B
JavaScript
// 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);
|