Options
All
  • Public
  • Public/Protected
  • All
Menu

Project lowest

Index

Type aliases

AnyObject

AnyObject: Dictionary<any>

A type representing general objects

Collection

Collection<T>: Dictionary<T> | List<T>

A read only List or Dictionary

Type parameters

  • T

Dictionary

Dictionary<T>: Readonly<Record<string, T>>

A read only dictionary. Keys are strings and values are of the same type T

Type parameters

  • T

    The dictionary item type

Entry

Entry<T>: [string, T]

A key and value pair - a dictionary entry

Type parameters

  • T

    The entry item type

Fn

Fn<I, O>: (i: I) => O

A function with one argument

Type parameters

  • I

  • O

Type declaration

    • (i: I): O
    • Parameters

      • i: I

      Returns O

Fn2

Fn2<A, B, R>: (a: A, b: B) => R

A function with two arguments

Type parameters

  • A

  • B

  • R

Type declaration

    • (a: A, b: B): R
    • Parameters

      • a: A
      • b: B

      Returns R

Fn3

Fn3<A, B, C, R>: (a: A, b: B, c: C) => R

A function with three arguments

Type parameters

  • A

  • B

  • C

  • R

Type declaration

    • (a: A, b: B, c: C): R
    • Parameters

      • a: A
      • b: B
      • c: C

      Returns R

List

List<T>: ReadonlyArray<T>

Type parameters

  • T

Maybe

Maybe<T>: T | undefined

Optional value

Type parameters

  • T

Predicate

Predicate<T>: (value: T) => boolean

A function returning a boolean value

Type parameters

  • T

Type declaration

    • (value: T): boolean
    • Parameters

      • value: T

      Returns boolean

Tuple

Tuple<L, R>: [L, R]

Type parameters

  • L

  • R

Functions

assign

  • assign<A, B>(a: A, b: B): A | B
  • assign<A, B>(b: B): Fn<A, A | B>
  • Assigns the entries of one object to another

    Type parameters

    • A: Readonly<Record<string, any>>

      the first object type

    • B: Readonly<Record<string, any>>

      the second object type

    Parameters

    • a: A

      An object

    • b: B

      Another object

    Returns A | B

    A new object containing all entries in a overridden with entries of b If an entry with the same key exists in both a and b the entries from b will be in the result

  • Type parameters

    • A: Readonly<Record<string, any>>

    • B: Readonly<Record<string, any>>

    Parameters

    • b: B

    Returns Fn<A, A | B>

chunk

  • chunk<T>(list: List<T>, size: number): LL<T>
  • chunk<T>(size: number): Fn<List<T>, LL<T>>
  • Returns a list of items split into lists the size of size. If the list can't be split evenly, the final chunk will include the remaining items.

    Type parameters

    • T

    Parameters

    • list: List<T>
    • size: number

    Returns LL<T>

  • Type parameters

    • T

    Parameters

    • size: number

    Returns Fn<List<T>, LL<T>>

Const compact

  • compact<T>(list: List<Nilable<T>>): List<T>
  • Returns a list with null or undefined items removed

    Type parameters

    • T

    Parameters

    • list: List<Nilable<T>>

      The List to remove from

    Returns List<T>

    A new list without null or undefined items

Const compactDictionary

  • compactDictionary<T>(dict: Readonly<Record<string, Nilable<T>>>): Readonly<Record<string, T>>

concat

drop

  • drop<T>(list: List<T>, size: number): List<T>
  • drop<T>(size: number): Fn<List<T>>
  • Remove the first items from a list

    Type parameters

    • T

      the item type

    Parameters

    • list: List<T>

      A list

    • size: number

      The number of first items to remove

    Returns List<T>

    A new list without the first size items

  • Type parameters

    • T

    Parameters

    • size: number

    Returns Fn<List<T>>

every

filter

filterDictionary

find

  • Find if an item exists in a collection

    Type parameters

    • T

      The type of the collection item

    Parameters

    Returns Maybe<T>

    The first item that satisfies the predicate or undefined if no item satisfies the predicate In case that the collection is a Dictionary, the entries are not ordered so if more than one item satisfies the predicate an arbitrary one will be returned

  • The curried version of find

    Type parameters

    • T

      The type of the collection item

    Parameters

    Returns Fn<Collection<T>, Maybe<T>>

    A function accepting a collection and optionally returning an item

flatMap

  • Transform and flatten a list

    Type parameters

    • I

      the input list item type

    • O

      the output list item type

    Parameters

    • list: List<I>

      A list

    • f: Fn<I, List<O>>

      A transform function from I to O

    Returns List<O>

    A new list where all items have been transformed by f and then flattened

  • Type parameters

    • I

    • O

    Parameters

    Returns Fn<List<I>, List<O>>

Const flatten

  • Flatten a list of lists

    Type parameters

    • T

      the list item type

    Parameters

    Returns List<T>

    A new flattened list where all items of lists in lists are concatenated

flow

  • flow<T, F1, F2, F3, F4, F5>(values: T, f1: Fn<T, F1>, f2: Fn<F1, F2>, f3: Fn<F2, F3>, f4: Fn<F3, F4>, f5: Fn<F4, F5>): F5
  • flow<T, F1, F2, F3, F4>(values: T, f1: Fn<T, F1>, f2: Fn<F1, F2>, f3: Fn<F2, F3>, f4: Fn<F3, F4>): F4
  • flow<T, F1, F2, F3>(values: T, f1: Fn<T, F1>, f2: Fn<F1, F2>, f3: Fn<F2, F3>): F3
  • flow<T, F1, F2>(values: T, f1: Fn<T, F1>, f2: Fn<F1, F2>): F2
  • flow<T, F1>(values: T, f1: Fn<T, F1>): F1
  • Composes and executes several functions

    Type parameters

    • T

    • F1

    • F2

    • F3

    • F4

    • F5

    Parameters

    • values: T

      The input to the composed function

    • f1: Fn<T, F1>

      See below

    • f2: Fn<F1, F2>

      See below

    • f3: Fn<F2, F3>

      See below

    • f4: Fn<F3, F4>

      See below

    • f5: Fn<F4, F5>

      See below

    Returns F5

    the last function's output The f1..f5 functions are executed in order, the first one is fed with values and each output is fed to the next function's input.

  • See the docs for the first overload

    Type parameters

    • T

    • F1

    • F2

    • F3

    • F4

    Parameters

    • values: T
    • f1: Fn<T, F1>
    • f2: Fn<F1, F2>
    • f3: Fn<F2, F3>
    • f4: Fn<F3, F4>

    Returns F4

  • See the docs for the first overload

    Type parameters

    • T

    • F1

    • F2

    • F3

    Parameters

    • values: T
    • f1: Fn<T, F1>
    • f2: Fn<F1, F2>
    • f3: Fn<F2, F3>

    Returns F3

  • See the docs for the first overload

    Type parameters

    • T

    • F1

    • F2

    Parameters

    • values: T
    • f1: Fn<T, F1>
    • f2: Fn<F1, F2>

    Returns F2

  • See the docs for the first overload

    Type parameters

    • T

    • F1

    Parameters

    • values: T
    • f1: Fn<T, F1>

    Returns F1

Const fromPairs

  • fromPairs<T>(entries: List<Entry<T>>): Readonly<Record<string, T>>

get

  • get<T, K>(obj: T, key: K): T[K]
  • get<T, K>(key: K): Fn<T, T[K]>
  • Get a value by key

    Type parameters

    • T: Readonly<Record<string, any>>

      The type of an object

    • K: string | number | symbol

      The type of the keys of T

    Parameters

    • obj: T

      An object

    • key: K

      A key

    Returns T[K]

    The value in obj for key

  • Type parameters

    • T: Readonly<Record<string, any>>

    • K: string | number | symbol

    Parameters

    • key: K

    Returns Fn<T, T[K]>

groupBy

  • groupBy<T>(list: List<T>, by: Key<T>): Grouped<T>
  • groupBy<T>(by: Key<T>): Fn<List<T>, Grouped<T>>
  • Group a list into a dictionary of lists

    Type parameters

    • T

      The list and dictionary item type

    Parameters

    • list: List<T>

      A list

    • by: Key<T>

      A function producing a string key to group by

    Returns Grouped<T>

    A dictionary with keys returned from by and lists of corresponding items from list The order in each group is the order of the items in list

  • Type parameters

    • T

    Parameters

    • by: Key<T>

    Returns Fn<List<T>, Grouped<T>>

has

  • has<T>(obj: T, key: keyof T): boolean
  • has<T>(key: keyof T): Fn<T, boolean>
  • Checks if a key exists

    template

    The type of the keys of T

    Type parameters

    • T: Readonly<Record<string, any>>

      The type of an object

    Parameters

    • obj: T

      An object

    • key: keyof T

      A key

    Returns boolean

    true if key exists in obj and false otherwise

  • Type parameters

    • T: Readonly<Record<string, any>>

    Parameters

    • key: keyof T

    Returns Fn<T, boolean>

Const head

  • head<T>(list: List<T>): T
  • Returns the first item in a list or throws an error if the list is empty

    throws

    An error if the list is empty

    Type parameters

    • T

    Parameters

    • list: List<T>

      A list

    Returns T

    The first item in the list

Const identity

  • identity<T>(value: T): T
  • The identity function - returns the accepted value

    Type parameters

    • T

    Parameters

    • value: T

      An input

    Returns T

    The input

Const invert

  • invert(dict: Readonly<Record<string, string | number>>): Readonly<Record<string, string>>
  • Returns a new dictionary with the keys and values of dict inverted. If dict contains duplicate values, one of them will be chosen arbitrarily.

    Parameters

    • dict: Readonly<Record<string, string | number>>

      A dictionary

    Returns Readonly<Record<string, string>>

    An inverted dictionary

keyBy

  • Returns a new dictionary with keys from calling by. The item for a key is the last item in list return from by for that key.

    Type parameters

    • T

    Parameters

    • list: List<T>

      A list

    • by: Key<T>

      A function that returns a key for a given item

    Returns Dictionary<T>

  • Type parameters

    • T

    Parameters

    • by: Key<T>

    Returns Fn<List<T>, Dictionary<T>>

Const keys

  • keys(dict: Readonly<Record<string, unknown>>): List<string>
  • Returns the keys of the dictionary

    Parameters

    • dict: Readonly<Record<string, unknown>>

      A dictionary

    Returns List<string>

    a list of keys

map

  • Transform all items of a list

    Type parameters

    • I

      The input type.

    • O

      The output type.

    Parameters

    • list: List<I>

      The list to map over.

    • f: Fn<I, O>

      The transform function.

    Returns List<O>

    The transformed list

  • Type parameters

    • I

    • O

    Parameters

    • f: Fn<I, O>

    Returns Fn<List<I>, List<O>>

mapDictionary

omit

  • omit<T, K>(obj: T, keys: List<K>): Omit<T, K>
  • omit<T, K>(keys: List<K>): Fn<T, Omit<T, K>>
  • Omits keys from an object

    Type parameters

    • T: Readonly<Record<string, any>>

      The type of an object

    • K: string | number | symbol

      The type of the keys of T

    Parameters

    • obj: T

      An object

    • keys: List<K>

      A list of keys in obj

    Returns Omit<T, K>

    An object with all entries with key in keys removed

  • Type parameters

    • T: Readonly<Record<string, any>>

    • K: string | number | symbol

    Parameters

    Returns Fn<T, Omit<T, K>>

pick

  • pick<T, K>(obj: T, keys: List<K>): Pick<T, K>
  • pick<T, K>(keys: List<K>): Fn<T, Pick<T, K>>
  • Picks keys from an object

    Type parameters

    • T: Readonly<Record<string, any>>

      The type of an object

    • K: string | number | symbol

      The type of the keys of T

    Parameters

    • obj: T

      An object

    • keys: List<K>

      A list of keys in obj

    Returns Pick<T, K>

    An object with entries where the entry key is in keys

  • Type parameters

    • T: Readonly<Record<string, any>>

    • K: string | number | symbol

    Parameters

    Returns Fn<T, Pick<T, K>>

set

  • set<T, K>(obj: T, key: K, value: T[K]): T
  • set<T, K>(key: K, value: T[K]): Fn<T>
  • Sets a value for a key in an object

    Type parameters

    • T: Readonly<Record<string, any>>

      The type of an object

    • K: string | number | symbol

      The type of the keys of T

    Parameters

    • obj: T

      An object

    • key: K

      A key

    • value: T[K]

      A value

    Returns T

    A new object with the value set for key

  • Type parameters

    • T: Readonly<Record<string, any>>

    • K: string | number | symbol

    Parameters

    • key: K
    • value: T[K]

    Returns Fn<T>

some

sortBy

  • sortBy<T>(list: List<T>, by: SortValue<T>): List<T>
  • sortBy<T>(sortValue: SortValue<T>): Fn<List<T>>
  • Sort a list

    Type parameters

    • T

      The list item type

    Parameters

    • list: List<T>

      A list

    • by: SortValue<T>

      A function returning a sort value for a given item The list is sorted by the value return from by. In case by returns an array of values, the list is primarily sorted by the 1st value, secondarily sorted by the 2nd value and so on

    Returns List<T>

  • Type parameters

    • T

    Parameters

    • sortValue: SortValue<T>

    Returns Fn<List<T>>

Const tail

  • Returns the tail of the list

    Type parameters

    • T

      the list item type

    Parameters

    • list: List<T>

      A list

    Returns List<T>

    All but the first item in a list

take

  • take<T>(list: List<T>, size: number): List<T>
  • take<T>(size: number): Fn<List<T>>
  • Takes first items from the list

    Type parameters

    • T

      The list item type

    Parameters

    • list: List<T>

      A list

    • size: number

      The number if items to take

    Returns List<T>

    A new list containing the first size items from list

  • Type parameters

    • T

    Parameters

    • size: number

    Returns Fn<List<T>>

Const toPairs

  • toPairs<T>(dict: Readonly<Record<string, T>>): List<Entry<T>>
  • Returns a list of dictionary entries

    Type parameters

    • T

      The type of the dictionary item

    Parameters

    • dict: Readonly<Record<string, T>>

      A dictionary

    Returns List<Entry<T>>

    A list of entries

Const uniq

  • Returns a unique list

    Type parameters

    • T

      the list item type

    Parameters

    • list: List<T>

      A list

    Returns List<T>

    A new list with unique items

Const unzip

  • Unzip a list of tuples

    Type parameters

    • L

      the left list item type

    • R

      the right list item type

    Parameters

    Returns Tuple<List<L>, List<R>>

    a tuple of lists

update

  • update<T, K>(obj: T, key: K, f: Fn<T[K]>): T
  • update<T, K>(key: K, f: Fn<T[K]>): Fn<T>
  • Update a value for a key on an object

    Type parameters

    • T: Readonly<Record<string, any>>

      The type of an object

    • K: string | number | symbol

      The type of the keys of T

    Parameters

    • obj: T

      An object

    • key: K

      A key

    • f: Fn<T[K]>

      An updater function accepting the existing value and returning a new value

    Returns T

    A new object with the new value returned from calling f set for key

  • Type parameters

    • T: Readonly<Record<string, any>>

    • K: string | number | symbol

    Parameters

    • key: K
    • f: Fn<T[K]>

    Returns Fn<T>

Const values

  • values<T>(dict: Readonly<Record<string, T>>): List<T>
  • Returns the values of a dictionary

    Type parameters

    • T

      The type of the dictionary item

    Parameters

    • dict: Readonly<Record<string, T>>

      A dictionary

    Returns List<T>

    A list of the dictionary values

zip

  • zip<L, R>(left: List<L>, right: List<R>): List<OptionalTuple<L, R>>
  • zip<L, R>(right: List<R>): Fn<List<L>, List<OptionalTuple<L, R>>>
  • Zip two lists

    Type parameters

    • L

      the left list item type

    • R

      the right list item type

    Parameters

    • left: List<L>

      A list

    • right: List<R>

      A list

    Returns List<OptionalTuple<L, R>>

    A list of tuples where each tuple has values from the corresponding * items in left and right If the lists are of different sizes, the returned list will have tuples where either left or right will be undefined. This way, the list is guarantied to include tuples with left and right values. See zipShort for comparison.

  • Type parameters

    • L

    • R

    Parameters

    Returns Fn<List<L>, List<OptionalTuple<L, R>>>

zipShort

  • Zip two lists

    Type parameters

    • L

      the left list item type

    • R

      the right list item type

    Parameters

    • left: List<L>

      A list

    • right: List<R>

      A list

    Returns List<Tuple<L, R>>

    A list of tuples where each tuple has values from the corresponding items in left and right If the lists are of different sizes, the returned list will have a size of a the shorter list. This way, the list is guarantied to include tuples with left and right values. See zipShort for comparison.

  • Type parameters

    • L

    • R

    Parameters

    Returns Fn<List<L>, List<Tuple<L, R>>>

Generated using TypeDoc