• Recursively normalizes the given object.

    • Creates a copy to prevent original input mutation
    • Skips non-enumerable properties
    • When stringifying, calls toJSON if implemented
    • Removes circular references
    • Translates non-serializable values (undefined/NaN/functions) to serializable format
    • Translates known global objects/classes to a string representations
    • Takes care of Error object serialization
    • Optionally limits depth of final output
    • Optionally limits number of properties/elements included in any single object/array

    Parameters

    • input: unknown

      The object to be normalized.

    • depth: number = 100

      The max depth to which to normalize the object. (Anything deeper stringified whole.)

    • maxProperties: number = +Infinity

      The max number of elements or properties to be included in any single array or object in the normallized output.

    Returns any

    A normalized version of the object, or "**non-serializable**" if any errors are thrown during normalization.

Generated using TypeDoc