Lurch core classes

Namespace

JSON

The functions documented below extend the built-in JSON functionality of Node and/or the browser.

Methods

static

copy(json) → {*}

A deep copy of a JSON structure, as another JSON structure.

Right now this is implemented in the easiest way; we simply serialize and then deserialize using the built-in methods of JSON.stringify() and JSON.parse(). This is, however, not a very efficient implementation, and could be improved later if needed.

Parameters

  • json *

    the structure to copy, which must be amenable to JSON encoding using JSON.stringify()

Returns

  • *

    if the input is an object, this is a deep copy; if the input was atomic, this is the same atomic

Source

static

equals(x, y) → {boolean}

Whether two objects that are amenable to JSON encoding are structurally equal.

Parameters

  • x *

    The first of the two objects; this must be amenable to JSON encoding

  • y *

    The second of the two objects; this must be amenable to JSON encoding

Returns

  • boolean

    Whether the two objects are structurally equal

Source