interface TreeIndexOptions<T, K = T> {
    allowDuplicates?: boolean;
    compareKeys?: (a: K, b: K) => boolean;
    elements?: Iterable<T, any, any>;
    getKey?: (elements: T) => K;
    isEqual?: (a: T, b: T) => boolean;
}

Type Parameters

  • T
  • K = T

Properties

allowDuplicates?: boolean

Set to false to prevent an element with the same key for which isEqual returns true to be added to the collection.

compareKeys?: (a: K, b: K) => boolean

Compares two keys and returns whether the first key is less than the second.

If left unspecified, a default function will be chosen that works on most keys.

elements?: Iterable<T, any, any>

An iterable that will be consumed to fill the collection.

getKey?: (elements: T) => K

Exctracts the key part of the element.

isEqual?: (a: T, b: T) => boolean

Used for checking two elements with the same key in the collection.