/** * @since 1.0.0 */ import type { Option } from "@fp-ts/core/Option"; import type { Predicate, Refinement } from "@fp-ts/core/Predicate"; import type { Equal } from "@fp-ts/data/Equal"; import type { HashSet } from "@fp-ts/data/HashSet"; import type { UpdateFn } from "@fp-ts/data/internal/HashMap/node"; declare const TypeId: unique symbol; /** * @since 1.0.0 * @category symbol */ export type TypeId = typeof TypeId; /** * @since 1.0.0 * @category models */ export interface HashMap extends Iterable, Equal { readonly _id: TypeId; } /** * @since 1.0.0 * @category refinements */ export declare const isHashMap: { (u: Iterable): u is HashMap; (u: unknown): u is HashMap; }; /** * Creates a new `HashMap`. * * @since 1.0.0 * @category constructors */ export declare const empty: () => HashMap; /** * Constructs a new `HashMap` from an array of key/value pairs. * * @since 1.0.0 * @category constructors */ export declare const make: >(...entries: Entries) => HashMap; /** * Constructs a new `HashMap` from an iterable of key/value pairs. * * @since 1.0.0 * @category constructors */ export declare const fromIterable: (entries: Iterable) => HashMap; /** * Checks if the `HashMap` contains any entries. * * @since 1.0.0 * @category elements */ export declare const isEmpty: (self: HashMap) => boolean; /** * Safely lookup the value for the specified key in the `HashMap` using the * internal hashing function. * * @since 1.0.0 * @category elements */ export declare const get: { (self: HashMap, key: K1): Option; (key: K1): (self: HashMap) => Option; }; /** * Lookup the value for the specified key in the `HashMap` using a custom hash. * * @since 1.0.0 * @category elements */ export declare const getHash: { (self: HashMap, key: K1, hash: number): Option; (key: K1, hash: number): (self: HashMap) => Option; }; /** * Unsafely lookup the value for the specified key in the `HashMap` using the * internal hashing function. * * @since 1.0.0 * @category unsafe */ export declare const unsafeGet: { (self: HashMap, key: K1): V; (key: K1): (self: HashMap) => V; }; /** * Checks if the specified key has an entry in the `HashMap`. * * @since 1.0.0 * @category elements */ export declare const has: { (self: HashMap, key: K1): boolean; (key: K1): (self: HashMap) => boolean; }; /** * Checks if the specified key has an entry in the `HashMap` using a custom * hash. * * @since 1.0.0 * @category elements */ export declare const hasHash: { (self: HashMap, key: K1, hash: number): boolean; (key: K1, hash: number): (self: HashMap) => boolean; }; /** * Sets the specified key to the specified value using the internal hashing * function. * * @since 1.0.0 * @category mutations */ export declare const set: { (self: HashMap, key: K, value: V): HashMap; (key: K, value: V): (self: HashMap) => HashMap; }; /** * Returns an `IterableIterator` of the keys within the `HashMap`. * * @since 1.0.0 * @category getters */ export declare const keys: (self: HashMap) => IterableIterator; /** * Returns a `HashSet` of keys within the `HashMap`. * * @since 1.0.0 * @category getter */ export declare const keySet: (self: HashMap) => HashSet; /** * Returns an `IterableIterator` of the values within the `HashMap`. * * @since 1.0.0 * @category getters */ export declare const values: (self: HashMap) => IterableIterator; /** * Returns the number of entries within the `HashMap`. * * @since 1.0.0 * @category getters */ export declare const size: (self: HashMap) => number; /** * Marks the `HashMap` as mutable. * * @since 1.0.0 * @category mutations */ export declare const beginMutation: (self: HashMap) => HashMap; /** * Marks the `HashMap` as immutable. * * @since 1.0.0 * @category mutations */ export declare const endMutation: (self: HashMap) => HashMap; /** * Mutates the `HashMap` within the context of the provided function. * * @since 1.0.0 * @category mutations */ export declare const mutate: { (self: HashMap, f: (self: HashMap) => void): HashMap; (f: (self: HashMap) => void): (self: HashMap) => HashMap; }; /** * Set or remove the specified key in the `HashMap` using the specified * update function. The value of the specified key will be computed using the * provided hash. * * The update function will be invoked with the current value of the key if it * exists, or `None` if no such value exists. * * @since 1.0.0 * @category mutations */ export declare const modifyAt: { (self: HashMap, key: K, f: UpdateFn): HashMap; (key: K, f: UpdateFn): (self: HashMap) => HashMap; }; /** * Alter the value of the specified key in the `HashMap` using the specified * update function. The value of the specified key will be computed using the * provided hash. * * The update function will be invoked with the current value of the key if it * exists, or `None` if no such value exists. * * This function will always either update or insert a value into the `HashMap`. * * @since 1.0.0 * @category mutations */ export declare const modifyHash: { (self: HashMap, key: K, hash: number, f: UpdateFn): HashMap; (key: K, hash: number, f: UpdateFn): (self: HashMap) => HashMap; }; /** * Updates the value of the specified key within the `HashMap` if it exists. * * @since 1.0.0 * @category mutations */ export declare const modify: { (self: HashMap, key: K, f: (v: V) => V): HashMap; (key: K, f: (v: V) => V): (self: HashMap) => HashMap; }; /** * Performs a union of this `HashMap` and that `HashMap`. * * @since 1.0.0 * @category mutations */ export declare const union: { (self: HashMap, that: HashMap): HashMap; (that: HashMap): (self: HashMap) => HashMap; }; /** * Remove the entry for the specified key in the `HashMap` using the internal * hashing function. * * @since 1.0.0 * @category mutations */ export declare const remove: { (self: HashMap, key: K): HashMap; (key: K): (self: HashMap) => HashMap; }; /** * Removes all entries in the `HashMap` which have the specified keys. * * @since 1.0.0 * @category mutations */ export declare const removeMany: { (self: HashMap, keys: Iterable): HashMap; (keys: Iterable): (self: HashMap) => HashMap; }; /** * Maps over the values of the `HashMap` using the specified function. * * @since 1.0.0 * @category mapping */ export declare const map: { (self: HashMap, f: (value: V) => A): HashMap; (f: (value: V) => A): (self: HashMap) => HashMap; }; /** * Maps over the entries of the `HashMap` using the specified function. * * @since 1.0.0 * @category mapping */ export declare const mapWithIndex: { (self: HashMap, f: (value: V, key: K) => A): HashMap; (f: (value: V, key: K) => A): (self: HashMap) => HashMap; }; /** * Chains over the values of the `HashMap` using the specified function. * * **NOTE**: the hash and equal of both maps have to be the same. * * @since 1.0.0 * @category sequencing */ export declare const flatMap: { (self: HashMap, f: (value: A) => HashMap): HashMap; (f: (value: A) => HashMap): (self: HashMap) => HashMap; }; /** * Chains over the entries of the `HashMap` using the specified function. * * **NOTE**: the hash and equal of both maps have to be the same. * * @since 1.0.0 * @category sequencing */ export declare const flatMapWithIndex: { (self: HashMap, f: (value: A, key: K) => HashMap): HashMap; (f: (value: A, key: K) => HashMap): (self: HashMap) => HashMap; }; /** * Applies the specified function to the values of the `HashMap`. * * @since 1.0.0 * @category traversing */ export declare const forEach: { (self: HashMap, f: (value: V) => void): void; (f: (value: V) => void): (self: HashMap) => void; }; /** * Applies the specified function to the entries of the `HashMap`. * * @since 1.0.0 * @category traversing */ export declare const forEachWithIndex: { (self: HashMap, f: (value: V, key: K) => void): void; (f: (value: V, key: K) => void): (self: HashMap) => void; }; /** * Reduces the specified state over the values of the `HashMap`. * * @since 1.0.0 * @category folding */ export declare const reduce: { (self: HashMap, z: Z, f: (z: Z, v: V) => Z): Z; (z: Z, f: (z: Z, v: V) => Z): (self: HashMap) => Z; }; /** * Reduces the specified state over the entries of the `HashMap`. * * @since 1.0.0 * @category folding */ export declare const reduceWithIndex: { (self: HashMap, zero: Z, f: (accumulator: Z, value: V, key: K) => Z): Z; (zero: Z, f: (accumulator: Z, value: V, key: K) => Z): (self: HashMap) => Z; }; /** * Filters entries out of a `HashMap` using the specified predicate. * * @since 1.0.0 * @category filtering */ export declare const filter: { (self: HashMap, f: Refinement): HashMap; (self: HashMap, f: Predicate): HashMap; (f: Refinement): (self: HashMap) => HashMap; (f: Predicate): (self: HashMap) => HashMap; }; /** * Filters entries out of a `HashMap` using the specified predicate. * * @since 1.0.0 * @category filtering */ export declare const filterWithIndex: { (self: HashMap, f: (a: A, k: K) => a is B): HashMap; (self: HashMap, f: (a: A, k: K) => boolean): HashMap; (f: (a: A, k: K) => a is B): (self: HashMap) => HashMap; (f: (a: A, k: K) => boolean): (self: HashMap) => HashMap; }; /** * Filters out `None` values from a `HashMap` of `Options`s. * * @since 1.0.0 * @category filtering */ export declare const compact: (self: HashMap>) => HashMap; /** * Maps over the values of the `HashMap` using the specified partial function * and filters out `None` values. * * @since 1.0.0 * @category filtering */ export declare const filterMap: { (self: HashMap, f: (value: A) => Option): HashMap; (f: (value: A) => Option): (self: HashMap) => HashMap; }; /** * Maps over the entries of the `HashMap` using the specified partial function * and filters out `None` values. * * @since 1.0.0 * @category filtering */ export declare const filterMapWithIndex: { (self: HashMap, f: (value: A, key: K) => Option): HashMap; (f: (value: A, key: K) => Option): (self: HashMap) => HashMap; }; export {}; //# sourceMappingURL=HashMap.d.ts.map