Skip to content

SortedMap

22 exports Added in v2.0.0 Source

Constructors

empty

Added in v2.0.0 Source

Signature

declare function empty<K, V = never>(ord: Order<K>): SortedMap<K, V>;

fromIterable

Added in v2.0.0 Source

Creates a new SortedMap from an iterable collection of key/value pairs.

Signature

declare const fromIterable: {
  <B>(ord: Order<B>): <K, V>(iterable: Iterable<readonly [K, V]>) => SortedMap<K, V>;
  <K, V, B>(iterable: Iterable<readonly [K, V]>, ord: Order<B>): SortedMap<K, V>;
};

make

Added in v2.0.0 Source

Signature

declare function make<K>(ord: Order<K>): <Entries extends readonly Array<readonly [K, any]>>(...entries: Entries) => SortedMap<K, Entries[number] extends readonly [any, V] ? V : never>

Elements

get

Added in v2.0.0 Source

Signature

declare const get: {
  <K>(key: K): <V>(self: SortedMap<K, V>) => Option<V>;
  <K, V>(self: SortedMap<K, V>, key: K): Option<V>;
};

has

Added in v2.0.0 Source

Signature

declare const has: {
  <K>(key: K): <V>(self: SortedMap<K, V>) => boolean;
  <K, V>(self: SortedMap<K, V>, key: K): boolean;
};

headOption

Added in v2.0.0 Source

Signature

declare function headOption<K, V>(self: SortedMap<K, V>): Option<[K, V]>;

lastOption

Added in v3.1.0 Source

Signature

declare function lastOption<K, V>(self: SortedMap<K, V>): Option<[K, V]>;

remove

Added in v2.0.0 Source

Signature

declare const remove: {
  <K>(key: K): <V>(self: SortedMap<K, V>) => SortedMap<K, V>;
  <K, V>(self: SortedMap<K, V>, key: K): SortedMap<K, V>;
};

set

Added in v2.0.0 Source

Signature

declare const set: {
  <K, V>(key: K, value: V): (self: SortedMap<K, V>) => SortedMap<K, V>;
  <K, V>(self: SortedMap<K, V>, key: K, value: V): SortedMap<K, V>;
};

Filtering

partition

Added in v3.1.0 Source

Signature

declare const partition: {
  <K, V>(
    predicate: (a: NoInfer<K>) => boolean,
  ): (self: SortedMap<K, V>) => [excluded: SortedMap<K, V>, satisfying: SortedMap<K, V>];
  <K, V>(
    self: SortedMap<K, V>,
    predicate: (a: K) => boolean,
  ): [excluded: SortedMap<K, V>, satisfying: SortedMap<K, V>];
};

Folding

reduce

Added in v2.0.0 Source

Signature

declare const reduce: {
  <B, A, K>(zero: B, f: (acc: B, value: A, key: K) => B): (self: SortedMap<K, A>) => B;
  <K, A, B>(self: SortedMap<K, A>, zero: B, f: (acc: B, value: A, key: K) => B): B;
};

Getters

entries

Added in v2.0.0 Source

Signature

declare function entries<K, V>(self: SortedMap<K, V>): IterableIterator<[K, V]>;

getOrder

Added in v2.0.0 Source

Gets the Order<K> that the SortedMap<K, V> is using.

Signature

declare function getOrder<K, V>(self: SortedMap<K, V>): Order<K>;

keys

Added in v2.0.0 Source

Signature

declare function keys<K, V>(self: SortedMap<K, V>): IterableIterator<K>;

size

Added in v2.0.0 Source

Signature

declare function size<K, V>(self: SortedMap<K, V>): number;

values

Added in v2.0.0 Source

Signature

declare function values<K, V>(self: SortedMap<K, V>): IterableIterator<V>;

Mapping

map

Added in v2.0.0 Source

Signature

declare const map: {
  <A, K, B>(f: (a: A, k: K) => B): (self: SortedMap<K, A>) => SortedMap<K, B>;
  <K, A, B>(self: SortedMap<K, A>, f: (a: A, k: K) => B): SortedMap<K, B>;
};

Models

SortedMap interface

Added in v2.0.0 Source

Signature

interface SortedMap<in out K, out V> extends Iterable<[K, V]>, Equal, Pipeable, Inspectable {
  readonly [TypeId]: {
    readonly _K: Invariant<K>;
    readonly _V: Covariant<V>;
  };
}

Predicates

isEmpty

Added in v2.0.0 Source

Signature

declare function isEmpty<K, V>(self: SortedMap<K, V>): boolean;

isNonEmpty

Added in v2.0.0 Source

Signature

declare function isNonEmpty<K, V>(self: SortedMap<K, V>): boolean;

Refinements

isSortedMap

Added in v2.0.0 Source

Signature

declare const isSortedMap: {
  <K, V>(u: Iterable<readonly [K, V]>): u is SortedMap<K, V>;
  (u: unknown): u is SortedMap<unknown, unknown>;
};

Symbol

TypeId type

Added in v2.0.0 Source

Signature

type TypeId = typeof TypeId;