➰ Remove all recursive references from the object
import preventObjectRecursion from '@rxluz/prevent-object-recursion';
const a = { hello: 'world' };
const b = { hey: 'hey', hello: a };
a.newProp = b;
console.log(preventObjectRecursion(a));
// => { hello: 'world', newProp: { hey: 'hey' }}
var preventObjectRecursion = require('@rxluz/prevent-object-recursion').default;
const a = { hello: 'world' };
const b = { hey: 'hey', hello: a };
a.newProp = b;
console.log(preventObjectRecursion(a));
// => { hello: 'world', newProp: { hey: 'hey' }}
With npm installed, run
$ npm i @rxluz/prevent-object-recursion --save
- This project was inspired by a chat in NodeJS Brasil Telegram Group.
- rxluz
MIT