Options
All
  • Public
  • Public/Protected
  • All
Menu

An alternative set implementation to the native ES6 Set type. Uses customizable equality/equivalence predicate and so is more useful when dealing with structured data. Implements full API of native Set and by the default uses equiv for equivalence checking.

Additionally, the type also implements the ICopy, IEmpty and IEquiv interfaces itself.

Type parameters

  • T

Hierarchy

  • Set<T>
    • ArraySet

Implements

Index

Constructors

constructor

Properties

Readonly Static [Symbol.species]

[Symbol.species]: SetConstructor

Accessors

[Symbol.species]

[Symbol.toStringTag]

  • get [Symbol.toStringTag](): string

size

  • get size(): number

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<T>

add

clear

  • clear(): void

copy

delete

  • delete(key: T): boolean

disj

empty

entries

  • entries(): IterableIterator<Pair<T, T>>

equiv

  • equiv(o: any): boolean

first

  • first(): undefined | T

forEach

  • forEach(fn: Fn3<T, T, Set<T>, void>, thisArg?: any): void
  • The value args given to the callback fn MUST be treated as readonly/immutable. This could be enforced via TS, but would break ES6 Set interface contract.

    Parameters

    • fn: Fn3<T, T, Set<T>, void>
    • Optional thisArg: any

    Returns void

get

  • get(key: T, notFound?: T): undefined | T
  • Returns the canonical value for x, if present. If the set contains no equivalent for x, returns notFound.

    Parameters

    • key: T

      search key

    • Optional notFound: T

      default value

    Returns undefined | T

has

  • has(key: T): boolean

into

keys

  • keys(): IterableIterator<T>

opts

values

  • values(): IterableIterator<T>

Generated using TypeDoc