rx-datatable API
    Preparing search index...

    Interface ISortedMapF<K, V>

    An interface for a functional sorted set: a functional set in which the keys (items) are sorted. This is a subinterface of ISortedMapF.

    interface ISortedMapF<K = any, V = any> {
        size: number;
        entries(firstKey?: K): IterableIterator<[K, V]>;
        filter(
            callback: (k: K, v: any, counter: number) => boolean,
            returnThisIfUnchanged?: boolean,
        ): ISortedMapF<K, V>;
        forEach(
            callbackFn: (v: V, k: K, map: IMapSource<K, V>) => void,
            thisArg?: any,
        ): void;
        forRange(
            low: K,
            high: K,
            includeHigh: boolean,
            onFound?: (k: K, v: V, counter: number) => void,
            initialCounter?: number,
        ): number;
        get(key: K): V | undefined;
        getRange(
            low: K,
            high: K,
            includeHigh?: boolean,
            maxLength?: number,
        ): [K, V][];
        has(key: K): boolean;
        keys(firstKey?: K): IterableIterator<K>;
        mapValues<R>(
            callback: (v: V, k: K, counter: number) => R,
        ): ISortedMapF<K, R>;
        maxKey(): K | undefined;
        minKey(): K | undefined;
        nextHigherKey(key?: K): K | undefined;
        nextHigherPair(key?: K): [K, V] | undefined;
        nextLowerKey(key?: K): K | undefined;
        nextLowerPair(key?: K): [K, V] | undefined;
        reduce<R>(
            callback: (
                previous: R,
                currentPair: [K, V],
                counter: number,
                tree: IMapF<K, V>,
            ) => R,
            initialValue: R,
        ): R;
        reduce<R>(
            callback: (
                previous: R | undefined,
                currentPair: [K, V],
                counter: number,
                tree: IMapF<K, V>,
            ) => R,
        ): R | undefined;
        values(firstKey?: K): IterableIterator<V>;
        with(key: K): ISortedMapF<K, V | undefined>;
        with<V2>(key: K, value: V2, overwrite?: boolean): ISortedMapF<K, V | V2>;
        withKeys(
            keys: K[],
            returnThisIfUnchanged?: boolean,
        ): ISortedMapF<K, V | undefined>;
        without(key: K): ISortedMapF<K, V>;
        withoutKeys(keys: K[], returnThisIfUnchanged?: boolean): ISortedMapF<K, V>;
        withoutRange(
            low: K,
            high: K,
            includeHigh: boolean,
            returnThisIfUnchanged?: boolean,
        ): ISortedMapF<K, V>;
        withPairs<V2>(
            pairs: [K, V | V2][],
            overwrite: boolean,
        ): ISortedMapF<K, V | V2>;
    }

    Type Parameters

    • K = any
    • V = any

    Hierarchy (View Summary)

    Index
    size: number

    Returns the number of key/value pairs in the map object.

    • Returns an iterator that provides all key-value pairs from the collection (as arrays of length 2).

      Parameters

      • OptionalfirstKey: K

      Returns IterableIterator<[K, V]>

    • Returns a copy of the tree with items removed whenever the callback function returns false.

      Parameters

      • callback: (k: K, v: any, counter: number) => boolean

        A function to call for each item in the set. The second parameter to callback exists because ISetF is a subinterface of IMapF. If the object is a map, v is the value associated with the key, otherwise v could be undefined or another copy of the third parameter (counter).

      • OptionalreturnThisIfUnchanged: boolean

      Returns ISortedMapF<K, V>

    • Calls callbackFn once for each key-value pair present in the map object. The ES6 Map class sends the value to the callback before the key, so this interface must do likewise.

      Parameters

      • callbackFn: (v: V, k: K, map: IMapSource<K, V>) => void
      • OptionalthisArg: any

      Returns void

    • Calls callback on the specified range of keys, in ascending order by key.

      Parameters

      • low: K

        The first key scanned will be greater than or equal to low.

      • high: K

        Scanning stops when a key larger than this is reached.

      • includeHigh: boolean

        If the high key is present in the map, onFound is called for that final pair if and only if this parameter is true.

      • OptionalonFound: (k: K, v: V, counter: number) => void

        A function that is called for each key pair. Because this is a subinterface of ISortedMapSource, if there is a value associated with the key, it is passed as the second parameter.

      • OptionalinitialCounter: number

        Initial third argument of onFound. This value increases by one each time onFound is called. Default: 0

      Returns number

      Number of pairs found and the number of times onFound was called.

    • Returns the value associated to the key, or undefined if there is none.

      Parameters

      • key: K

      Returns V | undefined

    • Builds an array of pairs from the specified range of keys, sorted by key. Each returned pair is also an array: pair[0] is the key, pair[1] is the value.

      Parameters

      • low: K

        The first key in the array will be greater than or equal to low.

      • high: K

        This method returns when a key larger than this is reached.

      • OptionalincludeHigh: boolean

        If the high key is present in the map, its pair will be included in the output if and only if this parameter is true. Note: if the low key is present, it is always included in the output.

      • OptionalmaxLength: number

        Maximum length of the returned array (default: unlimited)

      Returns [K, V][]

      Computational complexity: O(result.length + log size)

    • Returns a boolean asserting whether the key exists in the map object or not.

      Parameters

      • key: K

      Returns boolean

    • Returns a new iterator for iterating the items in the set (the order is implementation-dependent).

      Parameters

      • OptionalfirstKey: K

      Returns IterableIterator<K>

    • Returns the next key larger than the specified key (or undefined if there is none). Also, nextHigherKey(undefined) returns the lowest key.

      Parameters

      • Optionalkey: K

      Returns K | undefined

    • Returns the next pair whose key is larger than the specified key (or undefined if there is none). If key === undefined, this function returns the lowest pair.

      Parameters

      • Optionalkey: K

      Returns [K, V] | undefined

    • Returns the next key smaller than the specified key (or undefined if there is none). Also, nextLowerKey(undefined) returns the highest key.

      Parameters

      • Optionalkey: K

      Returns K | undefined

    • Returns the next pair whose key is smaller than the specified key (or undefined if there is none). If key === undefined, this function returns the highest pair.

      Parameters

      • Optionalkey: K

      Returns [K, V] | undefined

    • Performs a reduce operation like the reduce method of Array. It is used to combine all pairs into a single value, or perform conversions.

      Type Parameters

      • R

      Parameters

      • callback: (previous: R, currentPair: [K, V], counter: number, tree: IMapF<K, V>) => R
      • initialValue: R

      Returns R

    • Performs a reduce operation like the reduce method of Array. It is used to combine all pairs into a single value, or perform conversions.

      Type Parameters

      • R

      Parameters

      • callback: (
            previous: R | undefined,
            currentPair: [K, V],
            counter: number,
            tree: IMapF<K, V>,
        ) => R

      Returns R | undefined

    • Returns a new iterator for iterating the values of each pair.

      Parameters

      • OptionalfirstKey: K

      Returns IterableIterator<V>

    • Returns a copy of the set with the specified key included.

      Parameters

      • key: K

      Returns ISortedMapF<K, V | undefined>

      You might wonder why this method accepts only one key instead of ...keys: K[]. The reason is that the derived interface IMapF expects the second parameter to be a value. Therefore withKeys() is provided to set multiple keys at once.

    • Returns a copy of the set with the specified key included.

      Type Parameters

      • V2

      Parameters

      • key: K
      • value: V2
      • Optionaloverwrite: boolean

      Returns ISortedMapF<K, V | V2>

      You might wonder why this method accepts only one key instead of ...keys: K[]. The reason is that the derived interface IMapF expects the second parameter to be a value. Therefore withKeys() is provided to set multiple keys at once.

    • Returns a copy of the tree with all the keys in the specified array present.

      Parameters

      • keys: K[]

        The keys to add.

      • OptionalreturnThisIfUnchanged: boolean

        If true, the method returns this when all of the keys are already present in the collection. The default value may be true or false depending on the concrete implementation of the interface (in BTree, the default is false.)

      Returns ISortedMapF<K, V | undefined>

    • Returns a copy of the tree with the specified range of keys removed.

      Parameters

      • low: K
      • high: K
      • includeHigh: boolean
      • OptionalreturnThisIfUnchanged: boolean

      Returns ISortedMapF<K, V>