import * as fun from "https://deno.land/x/fun@v2.0.0/record.ts";
ReadonlyRecord is a readonly product structure that operates like a Map. Keys are always strings and Key/Value pairs can be added and removed arbitrarily. The ReadonlyRecord type in fun favors immutability.
Variables
The canonical implementation of Filterable for ReadonlyRecord. It contains the methods filter, filterMap, partition, and partitionMap. | |
The canonical implementation of Foldable for ReadonlyRecord. It contains the method fold. | |
The canonical implementation of Mappable for ReadonlyRecord. It contains the method map. | |
The canonical implementation of Traversable for ReadonlyRecord. It contains the methods map, fold, and traverse. |
Functions
Collect all values in a ReadonlyRecord into a single value I by using a Combinable. This is effectively fold using a Combinable for the initial value and combination. | |
Collect all values in a ReadonlyRecord into a single value I by using a Combinable and a mapping function from A to I. This is effectively fold using a Combinable for the initial value. | |
Remove the value and key at key from a ReadonlyRecord. If the record does not hold the key then no change is made and the original record is returned. | |
Remove the key from the ReadonlyRecord, returning a pair containing the new record and an Option containing the removed key value. If the record did not hold the specified key then this is a non-op and the return will be the original record and none. | |
An alias of Object.entries | |
Given a refinement or a predicate, filter a ReadonlyRecord by removing any values that do not match the predicate or refinement. ie. When the predicate/refinement return true a value is kept and when it returns false a value is removed. | |
Given a function over the values in a ReadonlyArray returning an Option, return a function thatsimultaneously filters and maps over the values in a ReadonlyRecord. | |
f fold | Collect all of the A values in a ReadonlyRecord into a single O value by the process of reduction. The order of key/value pairs in this reduction are stable and determined by ecmascript standard here. |
Given a Showable for the inner values of a ReadonlyRecord, return an instance of Showable for ReadonlyRecord. | |
Insert a value A into a ReadonlyRecord at the key location. If the value inserted has object equality with the current value in the record then no change is made and the original record is returned. | |
Insert a value A into a ReadonlyRecord at the key location. If the value inserted has object equality with the current value in the record then no change is made and the original record is returned. This is the same function as insert but with the order of parameters swapped | |
Given an instance of Comparable for the values in a ReadonlyRecord
return a curried function | |
f keys | An alias of Object.keys specific to ReadonlyRecord. |
Lookup the value at key. Returns an Option, where None indicates that the record does not hold the key. | |
Lookup the value in a record at key and return an optional pair with the key and the value if the record holds the key. Returns None if the record does not hold the key. | |
f map | Creates a new object with the same keys of |
Modify a value A into a ReadonlyRecord at the key location. If the object does not hold the specified key then no change is made. | |
Modify a value A into a ReadonlyRecord at the key location. If the object does not hold the specified key then no change is made. This is the same function as modify with the order of parameters flipped. | |
f omit | Omit specified |
Given a refinement or predicate, return a function that splits a ReadonlyRecord into a Pair of ReadonlyRecords, with the first record containing the values for which the predicate/refinement returned true and the second record containing the values for which the predicate/refinement returned false. | |
Given a function that takes an A and a key and returns an Either<J, K> return a function that simultaneously partitions and maps over the values in a ReadonlyRecord. This is the equivalent of first partitioning a ReadonlyRecord, and then using Pair's Bimap over both values in a Pair. | |
f pick | Picks specified |
Sequence over an ReadonlyRecord of type V, inverting the relationship between V and ReadonlyRecord. This function also keeps the indexed types of in each V at covariant position 0. In other words sequence over [Option, Option] becomes Option<[number, string]>. | |
Traverse a ReadonlyRecord, mapping each A into an algebraic data type V (so V), then collecting each I in V back into a ReadonlyRecord, ultimately returning V<ReadonlyRecord>. In more concrete terms this can take ReadonlyRecord<Option> and return Option<ReadonlyRecord> (or any other inner type. | |
Update a ReadonlyRecord at key with a value A. The record will only be updated if it already holds the specified key, otherwise no changes are made. | |
Update a ReadonlyRecord at key with a value A. The record will only be updated if it already holds the specified key, otherwise no changes are made. This function does the same as update but has the parameters switched in order |
Interfaces
Specifies ReadonlyRecord as a Higher Kinded Type, with covariant parameter A corresponding to the 0th index of any substitutions. |
Type Aliases
A type used to constrain an input to a ReadonlyRecord with any values. | |
NonEmptyRecord is a bounding type that will return a type level never if the type value of R is either not a record is a record without any index or key values. | |
ReadonlyRecord is an alias of Readonly<Record<string, A>>. It's meant to be used wherever a Record can be used. | |
Extract the inner type of a ReadonlyRecord |