Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JSONDeltaImpl

Implementation of JSONDelta.

inheritdoc

Hierarchy

  • JSONDeltaImpl

Implements

Index

Constructors

constructor

  • Create a new JSONDeltaImpl

    throws

    an InvalidDataError if a binaryDelta was supplied but it could not be parsed

    Parameters

    • factory: {}

      constructor function for creating JSON objects

    • original: BufferSlice

      the original JSON data

    • newValue: BufferSlice

      the modified JSON data

    • binaryDelta: BinaryDeltaImpl

      the binary delta between the original and the modified data.

    Returns JSONDeltaImpl

Properties

Private Readonly factory

factory: {}

A constructor function for creating JSON objects

Type declaration

Private Readonly insertedMap

insertedMap: JSONPointerMap = new JSONPointerMap()

The parts of the second JSON value not found in the first JSON value.

Private Readonly removedMap

removedMap: JSONPointerMap = new JSONPointerMap()

The parts of the first JSON value not found in the second JSON value.

Methods

Private copyPartOf

  • Return a JSON object from a part of a BufferSlice. The buffer is copied before being passed to the JSON constructor.

    Parameters

    • value: BufferSlice

      the buffer slice to construct the JSON from

    • start: number

      the offset in the buffer slice

    • length: number

      the number of bytes to use from the buffer slice

    Returns JSON

    a JSON object constructed from the part of the buffer slice

hasChanges

  • hasChanges(): boolean
  • Returns whether the two JSON values used to create this instance are different.

    Returns boolean

    true if this delta has an effect

inserted

  • Returns the parts of the second JSON value not found in the first JSON value.

    Returns ChangeMap

    the removed parts. The JSON Pointer references used for the keys are relative to second JSON value.

Private partOf

  • Return a JSON object from a part of a BufferSlice.

    Parameters

    • value: BufferSlice

      the buffer slice to construct the JSON from

    • start: number

      the offset in the buffer slice

    • length: number

      the number of bytes to use from the buffer slice

    Returns JSON

    a JSON object constructed from the part of the buffer slice

removed

  • Returns the parts of the first JSON value not found in the second JSON value.

    Returns ChangeMap

    the removed parts. The JSON Pointer references used for the keys are relative to first JSON value.

toString

  • toString(): string
  • Convert the JSON delta to a string

    Returns string

    a string representation of the JSON delta

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.