import "../../../Operator/index.js"; import type { Either } from "../../../Either/index.js"; import type { Predicate, Refinement } from "../../../Function/index.js"; import * as O from "../../../Option/index.js"; import type { MutableRecord } from "../../../Support/Mutable/index.js"; import type { PredicateWithIndex, RefinementWithIndex } from "../../../Utils/index.js"; import * as Tp from "../Tuple/index.js"; export declare type Dictionary = { readonly [P in string]: T; }; /** * Build a readonly record from a mutable version */ export declare function fromMutable(r: MutableRecord): Dictionary; /** * Converts the record to a mutable version */ export declare function toMutable(r: Dictionary): MutableRecord; /** * Calculate the number of key/value pairs in a record */ export declare function size(r: Dictionary): number; /** * Test whether a record is empty */ export declare function isEmpty(r: Dictionary): boolean; /** * Extract record keys */ export declare function keys(r: Dictionary): ReadonlyArray; /** * Extract record values */ export declare function values(r: Dictionary): ReadonlyArray; /** * Map a record into an array */ export declare function collect(f: (k: string, a: A) => B): (r: Dictionary) => ReadonlyArray; /** * Map a record into an array */ export declare function collect_(r: Dictionary, f: (k: string, a: A) => B): ReadonlyArray; /** * Insert or replace a key/value pair in a record */ export declare function insertAt(k: string, a: A): (r: Dictionary) => Dictionary; /** * Insert or replace a key/value pair in a record */ export declare function insertAt_(r: Dictionary, k: string, a: A): Dictionary; /** * Check if k is a key */ export declare function hasOwnProperty(r: Dictionary, k: string): boolean; /** * Delete a key */ export declare function deleteAt(k: string): (r: Dictionary) => Dictionary; /** * Delete a key */ export declare function deleteAt_(r: Dictionary, k: string): Dictionary; /** * Update a key value pair */ export declare function updateAt(k: string, a: A): (r: Dictionary) => O.Option>; /** * Update a key value pair */ export declare function updateAt_(r: Dictionary, k: string, a: A): O.Option>; /** * Modify the value at key k with f */ export declare function modifyAt(k: string, f: (a: A) => A): (r: Dictionary) => O.Option>; /** * Modify the value at key k with f */ export declare function modifyAt_(r: Dictionary, k: string, f: (a: A) => A): O.Option>; /** * Delete a key and value from a map, returning the value as well as the subsequent map */ export declare function pop(k: string): (r: Dictionary) => O.Option]>>; /** * Delete a key and value from a map, returning the value as well as the subsequent map */ export declare function pop_(r: Dictionary, k: string): O.Option]>>; /** * Lookup the value for a key in a record */ export declare function lookup_(r: Dictionary, k: string): O.Option; /** * Lookup the value for a key in a record */ export declare function lookup(k: string): (r: Dictionary) => O.Option; /** * Empty record */ export declare const empty: Dictionary; /** * Map a record passing the keys to the iterating function */ export declare function mapWithIndex(f: (k: string, a: A) => B): (fa: Dictionary) => Dictionary; /** * Map a record passing the keys to the iterating function */ export declare function mapWithIndex_(fa: Dictionary, f: (k: string, a: A) => B): Dictionary; /** * Map a record passing the values to the iterating function */ export declare function map(f: (a: A) => B): (fa: Dictionary) => Dictionary; /** * Map a record passing the values to the iterating function */ export declare function map_(fa: Dictionary, f: (a: A) => B): Dictionary; /** * Reduce the record passing the index toghether with the value to f */ export declare function reduceWithIndex(b: B, f: (k: string, b: B, a: A) => B): (fa: Dictionary) => B; /** * Reduce the record passing the index toghether with the value to f */ export declare function reduceWithIndex_(fa: Dictionary, b: B, f: (k: string, b: B, a: A) => B): B; /** * Reduce the record passing the index toghether with the value to f * * Inverted order */ export declare function reduceRightWithIndex(b: B, f: (k: string, a: A, b: B) => B): (fa: Dictionary) => B; /** * Reduce the record passing the index toghether with the value to f * * Inverted order */ export declare function reduceRightWithIndex_(fa: Dictionary, b: B, f: (k: string, a: A, b: B) => B): B; /** * Create a record with one key/value pair */ export declare function singleton(k: string, a: A): Dictionary; /** * Partition a record using f that also consumes the entry key */ export declare function partitionMapWithIndex(f: (key: string, a: A) => Either): (fa: Dictionary) => Tp.Tuple<[Dictionary, Dictionary]>; /** * Partition a record using f that also consumes the entry key */ export declare function partitionMapWithIndex_(fa: Dictionary, f: (key: string, a: A) => Either): Tp.Tuple<[Dictionary, Dictionary]>; /** * Partition a record using a predicate that also consumes the entry key */ export declare function partitionWithIndex(refinementWithIndex: RefinementWithIndex): (fa: Dictionary) => Tp.Tuple<[Dictionary, Dictionary]>; export declare function partitionWithIndex(predicateWithIndex: PredicateWithIndex): (fa: Dictionary) => Tp.Tuple<[Dictionary, Dictionary]>; /** * Partition a record using a predicate that also consumes the entry key */ export declare function partitionWithIndex_(fa: Dictionary, refinementWithIndex: RefinementWithIndex): Tp.Tuple<[Dictionary, Dictionary]>; export declare function partitionWithIndex_(fa: Dictionary, predicateWithIndex: PredicateWithIndex): Tp.Tuple<[Dictionary, Dictionary]>; /** * Filter & map the record entries with f that consumes also the entry index */ export declare function filterMapWithIndex(f: (key: string, a: A) => O.Option): (fa: Dictionary) => Dictionary; /** * Filter & map the record entries with f that consumes also the entry index */ export declare function filterMapWithIndex_(fa: Dictionary, f: (key: string, a: A) => O.Option): Dictionary; /** * Filter the record entries with f that consumes also the entry index */ export declare function filterWithIndex(refinementWithIndex: RefinementWithIndex): (fa: Dictionary) => Dictionary; export declare function filterWithIndex(predicateWithIndex: PredicateWithIndex): (fa: Dictionary) => Dictionary; /** * Filter the record entries with f that consumes also the entry index */ export declare function filterWithIndex_(fa: Dictionary, refinementWithIndex: RefinementWithIndex): Dictionary; export declare function filterWithIndex_(fa: Dictionary, predicateWithIndex: PredicateWithIndex): Dictionary; /** * Checks a predicate against all the record entries */ export declare function every(predicate: Predicate): (r: Dictionary) => boolean; /** * Checks a predicate against all the record entries */ export declare function every_(r: Dictionary, predicate: Predicate): boolean; /** * Checks a predicate against some of the record entries */ export declare function some(predicate: (a: A) => boolean): (r: Dictionary) => boolean; /** * Checks a predicate against some of the record entries */ export declare function some_(r: Dictionary, predicate: (a: A) => boolean): boolean; /** * Drop the None entries */ export declare const compact: (fa: Dictionary>) => Dictionary; /** * Separate the record entries */ export declare const separate: (fa: Dictionary>) => Tp.Tuple<[Dictionary, Dictionary]>; /** * Filter record entries according to a predicate */ export declare const filter: { (refinement: Refinement): (fa: Dictionary) => Dictionary; (predicate: Predicate): (fa: Dictionary) => Dictionary; }; /** * Filter record entries according to a predicate */ export declare const filter_: { (fa: Dictionary, refinement: Refinement): Dictionary; (fa: Dictionary, predicate: Predicate): Dictionary; }; /** * Filter & map record entries according to a predicate */ export declare const filterMap: (f: (a: A) => O.Option) => (fa: Dictionary) => Dictionary; /** * Filter & map record entries according to a predicate */ export declare const filterMap_: (fa: Dictionary, f: (a: A) => O.Option) => Dictionary; /** * Partition record entries according to a predicate */ export declare const partition: { (refinement: Refinement): (fa: Dictionary) => Tp.Tuple<[Dictionary, Dictionary]>; (predicate: Predicate): (fa: Dictionary) => Tp.Tuple<[Dictionary, Dictionary]>; }; /** * Partition record entries according to a predicate */ export declare const partition_: { (fa: Dictionary, refinement: Refinement): Tp.Tuple<[ Dictionary, Dictionary ]>; (fa: Dictionary, predicate: Predicate): Tp.Tuple<[ Dictionary, Dictionary ]>; }; /** * Partition & map record entries */ export declare const partitionMap: { (f: (a: A) => Either): (fa: Dictionary) => Tp.Tuple<[Dictionary, Dictionary]>; (f: (a: A) => Either): (fa: Dictionary) => Tp.Tuple<[Dictionary, Dictionary]>; }; /** * Partition & map record entries */ export declare const partitionMap_: (fa: Dictionary, f: (a: A) => Either) => Tp.Tuple<[Dictionary, Dictionary]>; /** * Reduce record entries */ export declare const reduce: (b: B, f: (b: B, a: A) => B) => (fa: Dictionary) => B; /** * Reduce record entries */ export declare const reduce_: (fa: Dictionary, b: B, f: (b: B, a: A) => B) => B; /** * Reduce record entries in inverted order */ export declare const reduceRight: (b: B, f: (a: A, b: B) => B) => (fa: Dictionary) => B; /** * Reduce record entries in inverted order */ export declare const reduceRight_: (fa: Readonly>, b: B, f: (a: A, b: B) => B) => B; /** * Converts a record into an array of [key, value] */ export declare const toArray: (r: Dictionary) => ReadonlyArray>; /** * Converts an array of [key, value] into a record */ export declare const fromArray: (_: readonly Tp.Tuple<[string, V]>[]) => Dictionary; //# sourceMappingURL=index.d.ts.map