Options
All
  • Public
  • Public/Protected
  • All
Menu

@rxluz/prevent-object-recursion

Index

Functions

preventObjectRecursion

  • preventObjectRecursion(root: any, list?: any): any
  • Removes all recursive references in a object

    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)

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

    Works in the browser as well as node.

    Parameters

    • root: any
    • Default value list: any = []

    Returns any

    Returns a new object without the recursive references.

Generated using TypeDoc