@rxluz/prevent-object-recursion
TypeScript icon, indicating that this package has built-in type declarations

0.0.20 • Public • Published

@rxluz/prevent-object-recursion

Remove all recursive references from the object

Build Status codecov Commitizen friendly

Usage

Example (es module)

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' }}

Example (commonjs)

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' }}

Install

With npm installed, run

$ npm i @rxluz/prevent-object-recursion --save

Acknowledgments

  • This project was inspired by a chat in NodeJS Brasil Telegram Group.
  • rxluz

See Also

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @rxluz/prevent-object-recursion

Weekly Downloads

0

Version

0.0.20

License

MIT

Unpacked Size

21 kB

Total Files

16

Last publish

Collaborators

  • rxluz