• Turns the input object into a string.

    Parameters

    Returns string

    The output string

    Remarks

    With the custom options, the output string can be either

    • a JSON string (identical to JSON.stringify())
    • an EJSON string (identical to bson.EJSON.stringify())
    • a minified version of either of the above, where some or specified keys will be replaced with a shorter identifier
    • a compressed version (by lz4js.compress()) of either of the above

    Example

    stringify(
    { long_key: "A Large Object" },
    (key, val) => {
    if (key === "long_key") {
    return "A Modified Large Object"
    }
    return val
    },
    2,
    {
    extended: false,
    minify: { enable: true, keyMap: { long_key: "lk" } },
    compress: false
    }
    )
  • Turns the input object into a string.

    Parameters

    Returns string

    The output string

    Remarks

    With the custom options, the output string can be either

    • a JSON string (identical to JSON.stringify())
    • an EJSON string (identical to bson.EJSON.stringify())
    • a minified version of either of the above, where some or specified keys will be replaced with a shorter identifier
    • a compressed version (by lz4js.compress()) of either of the above

    Example

    stringify(
    { long_key: "A Large Object" },
    {
    extended: false,
    minify: { enable: true, keyMap: { long_key: "lk" } },
    compress: false
    }
    )

Generated using TypeDoc