← Back

Source

strmap

Functor1<URI> &
  Foldable2v1<URI> &
  Traversable2v1<URI> &
  Compactable1<URI> &
  Filterable1<URI> &
  Witherable1<URI>

Added in v1.0.0 (instance)

StrMap

constructor(readonly value: { [key: string]: A }) {}

Added in v1.0.0 (data)

filter

(p: Predicate<A>): StrMap<A>

Added in v1.4.0 (method)

map

<B>(f: (a: A) => B): StrMap<B>

Added in v1.0.0 (method)

mapWithKey

<B>(f: (k: string, a: A) => B): StrMap<B>

Added in v1.0.0 (method)

reduce

<B>(b: B, f: (b: B, a: A) => B): B

Added in v1.0.0 (method)

empty

const empty: StrMap<never>

Added in v1.10.0 (constant)

collect

<A, B>(d: StrMap<A>, f: (k: string, a: A) => B): Array<B>

Added in v1.0.0 (function)

fromFoldable

fromFoldable<F>(
  F: Foldable<F>
): <A>(ta: HKT<F, [string, A]>, f: (existing: A, a: A) => A) => StrMap<A>

Added in v1.0.0 (function)

Create a dictionary from a foldable collection of key/value pairs, using the specified function to combine values for duplicate keys.

getMonoid

<A = never>(S: Semigroup<A> = getLastSemigroup()): Monoid<StrMap<A>>

Added in v1.0.0 (function)

getSetoid

<A>(S: Setoid<A>): Setoid<StrMap<A>>

Added in v1.0.0 (function)

insert

<A>(k: string, a: A, d: StrMap<A>): StrMap<A>

Added in v1.0.0 (function)

Insert or replace a key/value pair in a map

isEmpty

<A>(d: StrMap<A>): boolean

Added in v1.0.0 (function)

Test whether a dictionary is empty

isSubdictionary

<A>(S: Setoid<A>): ((d1: StrMap<A>, d2: StrMap<A>) => boolean)

Added in v1.0.0 (function)

Test whether one dictionary contains all of the keys and values contained in another dictionary

lookup

<A>(k: string, d: StrMap<A>): Option<A>

Added in v1.0.0 (function)

Lookup the value for a key in a dictionary

pop

<A>(k: string, d: StrMap<A>): Option<[A, StrMap<A>]>

Added in v1.0.0 (function)

Delete a key and value from a map, returning the value as well as the subsequent map

remove

<A>(k: string, d: StrMap<A>): StrMap<A>

Added in v1.0.0 (function)

Delete a key and value from a map

singleton

<A>(k: string, a: A): StrMap<A>

Added in v1.0.0 (function)

Create a dictionary with one key/value pair

size

<A>(d: StrMap<A>): number

Added in v1.0.0 (function)

Calculate the number of key/value pairs in a dictionary

toArray

<A>(d: StrMap<A>): Array<[string, A]>

Added in v1.0.0 (function)

toUnfoldable

<F>(U: Unfoldable<F>): (<A>(d: StrMap<A>) => HKT<F, [string, A]>)

Added in v1.0.0 (function)

Unfolds a dictionary into a list of key/value pairs

traverseWithKey

traverseWithKey<F>(
  F: Applicative<F>
): <A, B>(ta: StrMap<A>, f: (k: string, a: A) => HKT<F, B>) => HKT<F, StrMap<B>>

Added in v1.0.0 (function)