Class DeltaSet<T>

A Set implementation that keeps a delta of changes made to it.

Type Parameters

  • T

    A type of elements of delta set.

Hierarchy

  • Set<T>
    • DeltaSet

Implements

Constructors

  • Constructs new delta set.

    Type Parameters

    • T

    Parameters

    • Optional values: null | Iterable<T>

      An iterable of elements be added to constructed delta set. Or null to add nothing.

    Returns DeltaSet<T>

Properties

#added: Set<T>
#removed: Set<T>
[toStringTag]: string
size: number

Returns

the number of (unique) elements in Set.

[species]: SetConstructor

Methods

  • Iterates over values in the set.

    Returns IterableIterator<T>

  • Appends a new element with a specified value to the end of this delta set. Unless the set contains this element already.

    Records element addition and forgets its removal unless the set contains it already.

    Parameters

    • value: T

      The value of the element to add.

    Returns DeltaSet<T>

    this delta set.

  • Removes all elements from this delta set.

    Records all elements removal and forgets all elements additions.

    Returns void

  • Removes the specified element from this delta set.

    Records element removal and forgets its addition if removal succeed.

    Parameters

    • value: T

      The value of the element to remove.

    Returns boolean

    true if element removed successfully; or false if this set did not contain the element.

  • Applies changes to this delta set.

    First removes elements to remove. Then appends elements to add.

    Records all changes made.

    Parameters

    • add: Iterable<T>

      An iterable of elements to add.

    • remove: Iterable<T> = []

      An iterable of elements to remove.

    Returns DeltaSet<T>

    this delta set.

  • Returns an iterable of [v,v] pairs for every value v in the set.

    Returns IterableIterator<[T, T]>

  • Executes a provided function once per each value in the Set object, in insertion order.

    Parameters

    • callbackfn: ((value, value2, set) => void)
        • (value, value2, set): void
        • Parameters

          • value: T
          • value2: T
          • set: Set<T>

          Returns void

    • Optional thisArg: any

    Returns void

  • Parameters

    • value: T

    Returns boolean

    a boolean indicating whether an element with the specified value exists in the Set or not.

  • Despite its name, returns an iterable of the values in the set.

    Returns IterableIterator<T>

  • Returns an iterable of values in the set.

    Returns IterableIterator<T>

Generated using TypeDoc