@types/ramda

  • Version 0.27.44
  • Published
  • 166 kB
  • 1 dependency
  • MIT license

Install

npm i @types/ramda
yarn add @types/ramda
pnpm add @types/ramda

Overview

TypeScript definitions for ramda

Index

Variables

Functions

Interfaces

Type Aliases

Variables

variable filter

const filter: Filter;
  • Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value).

variable reject

const reject: Filter;
  • Similar to filter, except that it keeps only values for which the given predicate function returns falsy.

Functions

function add

add: { (a: number, b: number): number; (a: number): (b: number) => number };
  • Adds two numbers. Equivalent to a + b but curried.

function addIndex

addIndex: {
<T, U>(fn: (f: (item: T) => U, list: readonly T[]) => U[]): any;
<T>(fn: (f: (item: T) => void, list: readonly T[]) => T[]): any;
<T, U>(fn: (f: (acc: U, item: T) => U, aci: U, list: readonly T[]) => U): any;
};
  • Creates a new list iteration function from an existing one by adding two new parameters to its callback function: the current index, and the entire list.

function adjust

adjust: {
<T>(index: number, fn: (a: T) => T, list: readonly T[]): T[];
<T>(index: number, fn: (a: T) => T): (list: readonly T[]) => T[];
};
  • Applies a function to the value at the given index of an array, returning a new copy of the array with the element at the given index replaced with the result of the function application.

function all

all: {
<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
};
  • Returns true if all elements of the list match the predicate, false if there are any that don't.

function allPass

allPass: (preds: readonly Pred[]) => Pred;
  • Given a list of predicates, returns a new predicate that will be true exactly when all of them are.

function always

always: <T>(val: T) => () => T;
  • Returns a function that always returns the given value.

function and

and: {
<T extends string | number | boolean | { and?: (...a: readonly any[]) => any }>(
fn1: T,
val2: any
): boolean;
<T extends string | number | boolean | { and?: (...a: readonly any[]) => any }>(
fn1: T
): (val2: any) => boolean;
};
  • A function that returns the first argument if it's falsy otherwise the second argument. Note that this is NOT short-circuited, meaning that if expressions are passed they are both evaluated.

function andThen

andThen: {
<A, B>(onSuccess: (a: A) => B | Promise<B>, promise: Promise<A>): Promise<B>;
<A, B>(onSuccess: (a: A) => B | Promise<B>): (promise: Promise<A>) => Promise<B>;
};
  • Returns the result of applying the onSuccess function to the value inside a successfully resolved promise. This is useful for working with promises inside function compositions.

function any

any: {
<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
};
  • Returns true if at least one of elements of the list match the predicate, false otherwise.

function anyPass

anyPass: <T>(preds: Array<SafePred<T>>) => SafePred<T>;
  • Given a list of predicates returns a new predicate that will be true exactly when any one of them is.

function ap

ap: {
<T, U>(fns: ((a: T) => U)[], vs: readonly T[]): U[];
<T, U>(fns: ((a: T) => U)[]): (vs: readonly T[]) => U[];
<X0, X1, R>(fn: (x1: X1, x0: X0) => R, fn1: (x1: X1) => X0): (x1: X1) => R;
};
  • ap applies a list of functions to a list of values.

function aperture

aperture: {
<T>(n: 1, list: readonly T[]): Array<[T]>;
<T>(n: 2, list: readonly T[]): [T, T][];
<T>(n: 3, list: readonly T[]): [T, T, T][];
<T>(n: 4, list: readonly T[]): [T, T, T, T][];
<T>(n: 5, list: readonly T[]): [T, T, T, T, T][];
<T>(n: 6, list: readonly T[]): [T, T, T, T, T, T][];
<T>(n: 7, list: readonly T[]): [T, T, T, T, T, T, T][];
<T>(n: 8, list: readonly T[]): [T, T, T, T, T, T, T, T][];
<T>(n: 9, list: readonly T[]): [T, T, T, T, T, T, T, T, T][];
<T>(n: 10, list: readonly T[]): [T, T, T, T, T, T, T, T, T, T][];
<T>(n: number, list: readonly T[]): T[][];
(n: number): <T>(list: readonly T[]) => T[][];
};
  • Returns a new list, composed of n-tuples of consecutive elements If n is greater than the length of the list, an empty list is returned.

function append

append: {
<T>(el: T, list: readonly T[]): T[];
<T>(el: T): <T>(list: readonly T[]) => T[];
};
  • Returns a new list containing the contents of the given list, followed by the given element.

function apply

apply: {
<T, U, TResult>(
fn: (arg0: T, ...args: readonly T[]) => TResult,
args: readonly U[]
): TResult;
<T, TResult>(fn: (arg0: T, ...args: readonly T[]) => TResult): <U>(
args: readonly U[]
) => TResult;
};
  • Applies function fn to the argument list args. This is useful for creating a fixed-arity function from a variadic function. fn should be a bound function if context is significant.

function applySpec

applySpec: {
<Obj extends Record<string, (...args: readonly any[]) => any>>(obj: Obj): (
...args: Parameters<ValueOfRecord<Obj>>
) => { [Key in keyof Obj]: ReturnType<Obj[Key]> };
<T>(obj: any): (...args: readonly any[]) => T;
};
  • Given a spec object recursively mapping properties to functions, creates a function producing an object of the same structure, by mapping each property to the result of calling its associated function with the supplied arguments.

function applyTo

applyTo: {
<T, U>(el: T, fn: (t: T) => U): U;
<T>(el: T): <U>(fn: (t: T) => U) => U;
};
  • Takes a value and applies a function to it. This function is also known as the thrush combinator.

function ascend

ascend: {
<T>(fn: (obj: T) => any, a: T, b: T): number;
<T>(fn: (obj: T) => any): (a: T, b: T) => number;
};
  • Makes an ascending comparator function out of a function that returns a value that can be compared with < and >.

function assoc

assoc: {
<T, U>(__: Placeholder, val: T, obj: U): <K extends string>(
prop: K
) => Record<K, T> & U;
<U, K extends string>(prop: K, __: any, obj: U): <T>(val: T) => Record<K, T> & U;
<T, U, K extends string>(prop: K, val: T, obj: U): Record<K, T> & U;
<T, K extends string>(prop: K, val: T): <U>(obj: U) => Record<K, T> & U;
<K extends string>(prop: K): AssocPartialOne<K>;
};
  • Makes a shallow clone of an object, setting or overriding the specified property with the given value.

function assocPath

assocPath: {
<T, U>(__: Placeholder, val: T, obj: U): (path: Path) => U;
<T, U>(path: Path, __: any, obj: U): (val: T) => U;
<T, U>(path: Path, val: T, obj: U): U;
<T, U>(path: Path, val: T): (obj: U) => U;
<T, U>(path: Path): any;
};
  • Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and placing the specific value at the tail end of that path.

function binary

binary: <T extends (...arg: any) => any>(
fn: T
) => (...arg: any) => ReturnType<T>;
  • Wraps a function of any arity (including nullary) in a function that accepts exactly 2 parameters. Any extraneous parameters will not be passed to the supplied function.

function bind

bind: {
<F extends (...args: readonly any[]) => any, T>(fn: F, thisObj: T): (
...args: Parameters<F>
) => ReturnType<F>;
<F extends (...args: readonly any[]) => any, T>(fn: F): (
thisObj: T
) => (...args: Parameters<F>) => ReturnType<F>;
};
  • Creates a function that is bound to a context. Note: R.bind does not provide the additional argument-binding capabilities of Function.prototype.bind.

function both

both: { (pred1: Pred, pred2: Pred): Pred; (pred1: Pred): (pred2: Pred) => Pred };
  • A function wrapping calls to the two functions in an && operation, returning the result of the first function if it is false-y and the result of the second function otherwise. Note that this is short-circuited, meaning that the second function will not be invoked if the first returns a false-y value.

function call

call: (
fn: (...args: readonly any[]) => (...args: readonly any[]) => any,
...args: readonly any[]
) => any;
  • Returns the result of calling its first argument with the remaining arguments. This is occasionally useful as a converging function for R.converge: the left branch can produce a function while the right branch produces a value to be passed to that function as an argument.

function chain

chain: {
<T, U>(fn: (n: T) => readonly U[], list: readonly T[]): U[];
<T, U>(fn: (n: T) => readonly U[]): (list: readonly T[]) => U[];
<X0, X1, R>(fn: (x0: X0) => (x1: X1) => R, fn1: (x1: X1) => X0): (x1: X1) => R;
};
  • chain maps a function over a list and concatenates the results. This implementation is compatible with the Fantasy-land Chain spec

function clamp

clamp: {
<T>(min: T, max: T, value: T): T;
<T>(min: T, max: T): (value: T) => T;
<T>(min: T): (max: T, value: T) => T;
<T>(min: T): (max: T) => (value: T) => T;
};
  • Restricts a number to be within a range. Also works for other ordered types such as Strings and Date

function clone

clone: { <T>(value: T): T; <T>(value: readonly T[]): T[] };
  • Creates a deep copy of the value which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.

function comparator

comparator: <T>(pred: (a: T, b: T) => boolean) => (x: T, y: T) => number;
  • Makes a comparator function out of a function that reports whether the first element is less than the second.

function complement

complement: <As extends any[]>(
pred: (...args: As) => boolean
) => (...args: As) => boolean;
  • Takes a function f and returns a function g such that: - applying g to zero or more arguments will give true if applying the same arguments to f gives a logical false value; and - applying g to zero or more arguments will give false if applying the same arguments to f gives a logical true value.

function compose

compose: {
<T1>(fn0: () => T1): () => T1;
<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (
x0: V0,
x1: V1,
x2: V2
) => T1;
<T1, T2>(fn1: (x: T1) => T2, fn0: () => T1): () => T2;
<V0, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2;
<V0, V1, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (
x0: V0,
x1: V1
) => T2;
<V0, V1, V2, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (
x0: V0,
x1: V1,
x2: V2
) => T2;
<T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T3;
<V0, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (
x: V0
) => T3;
<V0, V1, T1, T2, T3>(
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1) => T1
): (x0: V0, x1: V1) => T3;
<V0, V1, V2, T1, T2, T3>(
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1, x2: V2) => T1
): (x0: V0, x1: V1, x2: V2) => T3;
<T1, T2, T3, T4>(
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: () => T1
): () => T4;
<V0, T1, T2, T3, T4>(
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x: V0) => T1
): (x: V0) => T4;
<V0, V1, T1, T2, T3, T4>(
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1) => T1
): (x0: V0, x1: V1) => T4;
<V0, V1, V2, T1, T2, T3, T4>(
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1, x2: V2) => T1
): (x0: V0, x1: V1, x2: V2) => T4;
<T1, T2, T3, T4, T5>(
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: () => T1
): () => T5;
<V0, T1, T2, T3, T4, T5>(
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x: V0) => T1
): (x: V0) => T5;
<V0, V1, T1, T2, T3, T4, T5>(
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1) => T1
): (x0: V0, x1: V1) => T5;
<V0, V1, V2, T1, T2, T3, T4, T5>(
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1, x2: V2) => T1
): (x0: V0, x1: V1, x2: V2) => T5;
<T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => T6,
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: () => T1
): () => T6;
<V0, T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => T6,
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x: V0) => T1
): (x: V0) => T6;
<V0, V1, T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => T6,
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1) => T1
): (x0: V0, x1: V1) => T6;
<V0, V1, V2, T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => T6,
fn4: (x: T4) => T5,
fn3: (x: T3) => T4,
fn2: (x: T2) => T3,
fn1: (x: T1) => T2,
fn0: (x0: V0, x1: V1, x2: V2) => T1
): (x0: V0, x1: V1, x2: V2) => T6;
};
  • Performs right-to-left function composition. The rightmost function may have any arity; the remaining functions must be unary.

function composeK

composeK: {
<V0, T1>(fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
<V0, T1, T2>(fn1: (x: T1) => T2[], fn0: (x0: V0) => T1[]): (x0: V0) => T2[];
<V0, T1, T2, T3>(
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]
): (x: V0) => T3[];
<V0, T1, T2, T3, T4>(
fn3: (x: T3) => T4[],
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]
): (x: V0) => T4[];
<V0, T1, T2, T3, T4, T5>(
fn4: (x: T4) => T5[],
fn3: (x: T3) => T4[],
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]
): (x: V0) => T5[];
<V0, T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => T6[],
fn4: (x: T4) => T5[],
fn3: (x: T3) => T4[],
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]
): (x: V0) => T6[];
};
  • Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by chain. The typings only support arrays for now. All functions must be unary. R.composeK(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f).

    Deprecated

    since 0.26 in favor of composeWith(chain)

function composeP

composeP: {
<V0, T1>(fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
<V0, T1, T2>(fn1: (x: T1) => Promise<T2>, fn0: (x0: V0) => Promise<T1>): (
x0: V0
) => Promise<T2>;
<V0, T1, T2, T3>(
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>
): (x: V0) => Promise<T3>;
<V0, T1, T2, T3, T4>(
fn3: (x: T3) => Promise<T4>,
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>
): (x: V0) => Promise<T4>;
<V0, T1, T2, T3, T4, T5>(
fn4: (x: T4) => Promise<T5>,
fn3: (x: T3) => Promise<T4>,
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>
): (x: V0) => Promise<T5>;
<V0, T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => Promise<T6>,
fn4: (x: T4) => Promise<T5>,
fn3: (x: T3) => Promise<T4>,
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>
): (x: V0) => Promise<T6>;
};
  • Performs right-to-left composition of one or more Promise-returning functions. All functions must be unary.

    Deprecated

    since 0.26 in favor of composeWith(then)

function composeWith

composeWith: {
<V0, T>(composer: (...args: any[]) => any, fns: ComposeWithFns<V0, T>): (
x0: V0
) => T;
(composer: (...args: any[]) => any): <V0, T>(
fns: ComposeWithFns<V0, T>
) => (x: V0) => T;
};
  • Performs right-to-left function composition using transforming function. With the current typings, all functions must be unary.

function concat

concat: {
(placeholder: Placeholder): (<L1 extends any[], L2 extends any[]>(
list1: L1,
list2: L2
) => [...L1, ...L2]) &
(<S1 extends string, S2 extends string>(s1: S1, s2: S2) => `${S1}${S2}`);
<L2 extends any[]>(placeholder: any, list2: L2): <L1 extends any[]>(
list1: L1
) => [...L1, ...L2];
<S2 extends string>(placeholder: any, s2: S2): <S1 extends string>(
s1: S1
) => `${S1}${S2}`;
<L1 extends any[]>(list1: L1): <L2 extends any[]>(list2: L2) => [...L1, ...L2];
<S1 extends string>(s1: S1): <S2 extends string>(s2: S2) => `${S1}${S2}`;
<L1 extends any[], L2 extends any[]>(list1: L1, list2: L2): [...L1, ...L2];
<S1 extends string, S2 extends string>(s1: S1, s2: S2): `${S1}${S2}`;
(s1: string, s2: string): string;
(s1: string): (s2: string) => string;
};
  • Returns the result of concatenating the given lists or strings.

function cond

cond: {
(fns: [Pred, (...a: readonly any[]) => any][]): (...a: readonly any[]) => any;
<A, B>(fns: [SafePred<A>, (...a: readonly A[]) => B][]): (
...a: readonly A[]
) => B;
};
  • Returns a function, fn, which encapsulates if/else-if/else logic. R.cond takes a list of [predicate, transform] pairs. All of the arguments to fn are applied to each of the predicates in turn until one returns a "truthy" value, at which point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates matches, fn returns undefined.

function construct

construct: <A extends any[], T>(
constructor: (new (...a: A) => T) | ((...a: A) => T)
) => (...a: A) => T;
  • Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type.

function constructN

constructN: <A extends any[], T>(
n: number,
constructor: (new (...a: A) => T) | ((...a: A) => T)
) => (...a: Partial<A>) => T;
  • Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. The arity of the function returned is specified to allow using variadic constructor functions.

function contains

contains: {
(__: Placeholder, list: string): (a: string) => boolean;
<T>(__: any, list: readonly T[]): (a: T) => boolean;
(__: any): (list: string, a: string) => boolean;
<T>(__: any): (list: readonly T[], a: T) => boolean;
(a: string, list: string): boolean;
<T>(a: T, list: readonly T[]): boolean;
(a: string): (list: string) => boolean;
<T>(a: T): (list: readonly T[]) => boolean;
};
  • Returns true if the specified item is somewhere in the list, false otherwise. Equivalent to indexOf(a)(list) > -1. Uses strict (===) equality checking.

    Deprecated

    since 0.26 in favor of includes

function converge

converge: (
after: (...a: readonly any[]) => any,
fns: ((...a: readonly any[]) => any)[]
) => (...a: readonly any[]) => any;
  • Accepts a converging function and a list of branching functions and returns a new function. When invoked, this new function is applied to some arguments, each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value.

function countBy

countBy: {
<T>(fn: (a: T) => string | number, list: readonly T[]): {
[index: string]: number;
};
<T>(fn: (a: T) => string | number): (
list: readonly T[]
) => { [index: string]: number };
};
  • Counts the elements of a list according to how many match each value of a key generated by the supplied function. Returns an object mapping the keys produced by fn to the number of occurrences in the list. Note that all keys are coerced to strings because of how JavaScript objects work.

function curry

curry: <F extends (...args: any) => any>(f: F) => any;
  • Returns a curried equivalent of the provided function. The curried function has two unusual capabilities. First, its arguments needn't be provided one at a time.

function curryN

curryN: {
<N extends number, F extends (...args: any) => any>(length: N, fn: F): any;
<N extends number>(length: N): <F extends (...args: any) => any>(fn: F) => any;
};
  • Returns a curried equivalent of the provided function, with the specified arity. The curried function has two unusual capabilities. First, its arguments needn't be provided one at a time.

function dec

dec: (n: number) => number;
  • Decrements its argument.

function defaultTo

defaultTo: {
<T, U>(a: T, b: U | null | undefined): T | U;
<T>(a: T): <U>(b: U) => T | U;
};
  • Returns the second argument if it is not null or undefined. If it is null or undefined, the first (default) argument is returned.

function descend

descend: {
<T>(fn: (obj: T) => any, a: T, b: T): number;
<T>(fn: (obj: T) => any): (a: T, b: T) => number;
};
  • Makes a descending comparator function out of a function that returns a value that can be compared with < and >.

function difference

difference: {
<T>(list1: readonly T[], list2: readonly T[]): T[];
<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
};
  • Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.

function differenceWith

differenceWith: {
<T1, T2>(
pred: (a: T1, b: T2) => boolean,
list1: readonly T1[],
list2: readonly T2[]
): T1[];
<T1, T2>(pred: (a: T1, b: T2) => boolean): (
list1: readonly T1[],
list2: readonly T2[]
) => T1[];
<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (
list2: readonly T2[]
) => T1[];
};
  • Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list. Duplication is determined according to the value returned by applying the supplied predicate to two list elements.

function dissoc

dissoc: {
<T extends object, K extends keyof T>(prop: K, obj: T): Omit<T, K>;
<K extends string | number>(prop: K): <T extends object>(obj: T) => Omit<T, K>;
};

    function dissocPath

    dissocPath: { <T>(path: Path, obj: any): T; <T>(path: Path): (obj: any) => T };
    • Makes a shallow clone of an object, omitting the property at the given path.

    function divide

    divide: {
    (__: Placeholder, b: number): (a: number) => number;
    (__: any): (b: number, a: number) => number;
    (a: number, b: number): number;
    (a: number): (b: number) => number;
    };
    • Divides two numbers. Equivalent to a / b.

    function drop

    drop: {
    <T>(n: number, xs: readonly T[]): T[];
    (n: number, xs: string): string;
    <T>(n: number): { (xs: string): string; (xs: readonly T[]): T[] };
    };
    • Returns a new list containing all but the first n elements of the given list.

    function dropLast

    dropLast: {
    <T>(n: number, xs: readonly T[]): T[];
    (n: number, xs: string): string;
    <T>(n: number): { (xs: readonly T[]): T[]; (xs: string): string };
    };
    • Returns a list containing all but the last n elements of the given list.

    function dropLastWhile

    dropLastWhile: {
    <T>(fn: (a: T) => boolean, list: readonly T[]): T[];
    <T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
    };
    • Returns a new list containing all but last then elements of a given list, passing each value from the right to the supplied predicate function, skipping elements while the predicate function returns true.

    function dropRepeats

    dropRepeats: <T>(list: readonly T[]) => T[];
    • Returns a new list without any consecutively repeating elements. R.equals is used to determine equality.

    function dropRepeatsWith

    dropRepeatsWith: {
    <T>(predicate: (left: T, right: T) => boolean, list: readonly T[]): T[];
    <T>(predicate: (left: T, right: T) => boolean): (list: readonly T[]) => T[];
    };
    • Returns a new list without any consecutively repeating elements. Equality is determined by applying the supplied predicate to each pair of consecutive elements. The first element in a series of equal elements will be preserved.

    function dropWhile

    dropWhile: {
    <T>(fn: (a: T) => boolean, list: readonly T[]): T[];
    <T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
    };
    • Returns a new list containing the last n elements of a given list, passing each value to the supplied predicate function, skipping elements while the predicate function returns true.

    function either

    either: {
    (pred1: Pred, pred2: Pred): Pred;
    (pred1: Pred): (pred2: Pred) => Pred;
    };
    • A function wrapping calls to the two functions in an || operation, returning the result of the first function if it is truth-y and the result of the second function otherwise. Note that this is short-circuited, meaning that the second function will not be invoked if the first returns a truth-y value.

    function empty

    empty: <T>(x: T) => T;
    • Returns the empty value of its argument's type. Ramda defines the empty value of Array ([]), Object ({}), String (''), and Arguments. Other types are supported if they define .empty and/or .prototype.empty. Dispatches to the empty method of the first argument, if present.

    function endsWith

    endsWith: {
    (a: string, list: string): boolean;
    (a: string): (list: string) => boolean;
    <T>(a: T | readonly T[], list: readonly T[]): boolean;
    <T>(a: T | readonly T[]): (list: readonly T[]) => boolean;
    };
    • Checks if a list ends with the provided values

    function eqBy

    eqBy: {
    <T, U = T>(fn: (a: T) => U, a: T, b: T): boolean;
    <T, U = T>(fn: (a: T) => U, a: T): (b: T) => boolean;
    <T, U = T>(fn: (a: T) => U): any;
    };
    • Takes a function and two values in its domain and returns true if the values map to the same value in the codomain; false otherwise.

    function eqProps

    eqProps: {
    <T, U>(prop: string, obj1: T, obj2: U): boolean;
    <P extends string>(prop: P): <T, U>(
    obj1: Record<P, T>,
    obj2: Record<P, U>
    ) => boolean;
    <T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
    };
    • Reports whether two functions have the same value for the specified property.

    function equals

    equals: {
    <T>(__: Placeholder, b: T): (a: T) => boolean;
    <T>(a: T, b: T): boolean;
    <T>(a: T): (b: T) => boolean;
    };
    • Returns true if its arguments are equivalent, false otherwise. Dispatches to an equals method if present. Handles cyclical data structures.

    function evolve

    evolve: {
    <E extends Evolver<any>, V extends Evolvable<E>>(
    transformations: E,
    obj: V
    ): Evolve<V, E>;
    <E extends Evolver<any>>(transformations: E): <V extends Evolvable<E>>(
    obj: V
    ) => Evolve<V, E>;
    };
    • Creates a new object by evolving a shallow copy of object, according to the transformation functions.

    function F

    F: () => boolean;

      function find

      find: {
      <T>(fn: (a: T) => boolean, list: readonly T[]): T | undefined;
      <T>(fn: (a: T) => boolean): (list: readonly T[]) => T;
      };
      • Returns the first element of the list which matches the predicate, or undefined if no element matches.

      function findIndex

      findIndex: {
      <T>(fn: (a: T) => boolean, list: readonly T[]): number;
      <T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
      };
      • Returns the index of the first element of the list which matches the predicate, or -1 if no element matches.

      function findLast

      findLast: {
      <T>(fn: (a: T) => boolean, list: readonly T[]): T | undefined;
      <T>(fn: (a: T) => boolean): (list: readonly T[]) => T;
      };
      • Returns the last element of the list which matches the predicate, or undefined if no element matches.

      function findLastIndex

      findLastIndex: {
      <T>(fn: (a: T) => boolean, list: readonly T[]): number;
      <T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
      };
      • Returns the index of the last element of the list which matches the predicate, or -1 if no element matches.

      function flatten

      flatten: <T extends readonly any[]>(list: T) => any;
      • Returns a new list by pulling every item out of it (and all its sub-arrays) and putting them in a new array, depth-first.

      function flip

      flip: {
      <T, U, TResult>(fn: (arg0: T, arg1: U) => TResult): (
      arg1: U,
      arg0?: T
      ) => TResult;
      <F extends (...args: any) => any, P extends any>(fn: F): any;
      };
      • Returns a new function much like the supplied one, except that the first two arguments' order is reversed.

      function forEach

      forEach: {
      <T>(fn: (x: T) => void, list: readonly T[]): T[];
      <T>(fn: (x: T) => void): (list: readonly T[]) => T[];
      <T>(fn: (x: T) => void, list: readonly T[]): T[];
      <T>(fn: (x: T) => void): (list: readonly T[]) => T[];
      };
      • Iterate over an input list, calling a provided function fn for each element in the list.

      function forEachObjIndexed

      forEachObjIndexed: {
      <T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void, obj: T): T;
      <T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void): (obj: T) => T;
      };
      • Iterate over an input object, calling a provided function fn for each key and value in the object.

      function fromPairs

      fromPairs: <V>(
      pairs: Array<KeyValuePair<string, V>> | Array<KeyValuePair<number, V>>
      ) => { [index: string]: V };
      • Creates a new object out of a list key-value pairs.

      function groupBy

      groupBy: {
      <T, K extends string = string>(fn: (a: T) => K, list: readonly T[]): Record<
      K,
      T[]
      >;
      <T, K extends string = string>(fn: (a: T) => K): (
      list: readonly T[]
      ) => Record<K, T[]>;
      };
      • Splits a list into sublists stored in an object, based on the result of calling a String-returning function on each element, and grouping the results according to values returned.

      function groupWith

      groupWith: {
      <T>(fn: (x: T, y: T) => boolean): (list: readonly T[]) => T[][];
      <T>(fn: (x: T, y: T) => boolean, list: readonly T[]): T[][];
      <T>(fn: (x: T, y: T) => boolean, list: string): string[];
      };
      • Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function

      function gt

      gt: {
      (__: Placeholder, b: number): (a: number) => boolean;
      (__: any): (b: number, a: number) => boolean;
      (a: number, b: number): boolean;
      (a: string, b: string): boolean;
      (a: number): (b: number) => boolean;
      };
      • Returns true if the first parameter is greater than the second.

      function gte

      gte: {
      (__: Placeholder, b: number): (a: number) => boolean;
      (__: any): (b: number, a: number) => boolean;
      (a: number, b: number): boolean;
      (a: string, b: string): boolean;
      (a: number): (b: number) => boolean;
      };
      • Returns true if the first parameter is greater than or equal to the second.

      function has

      has: {
      (__: Placeholder, obj: unknown): (s: string) => boolean;
      (__: any): <P extends string>(obj: unknown, s: P) => obj is any;
      <P extends string>(s: P, obj: unknown): obj is any;
      <P extends string>(s: P): (obj: unknown) => obj is any;
      };
      • Returns whether or not an object has an own property with the specified name.

      function hasIn

      hasIn: { <T>(s: string, obj: T): boolean; (s: string): <T>(obj: T) => boolean };
      • Returns whether or not an object or its prototype chain has a property with the specified name

      function hasPath

      hasPath: {
      <T>(list: readonly string[], obj: T): boolean;
      (list: readonly string[]): <T>(obj: T) => boolean;
      };
      • Returns whether or not a path exists in an object. Only the object's own properties are checked.

      head: {
      (str: string): string;
      (list: readonly []): undefined;
      <T extends unknown>(list: readonly T[]): T;
      };
      • Returns the first element in a list. In some libraries this function is named first.

      function identical

      identical: { <T>(a: T, b: T): boolean; <T>(a: T): (b: T) => boolean };
      • Returns true if its arguments are identical, false otherwise. Values are identical if they reference the same memory. NaN is identical to NaN; 0 and -0 are not identical.

      function identity

      identity: <T>(a: T) => T;
      • A function that does nothing but return the parameter supplied to it. Good as a default or placeholder function.

      function ifElse

      ifElse: {
      (fn: Pred, onTrue: Arity1Fn, onFalse: Arity1Fn): Arity1Fn;
      (fn: Pred, onTrue: Arity2Fn, onFalse: Arity2Fn): Arity2Fn;
      };
      • Creates a function that will process either the onTrue or the onFalse function depending upon the result of the condition predicate.

      function inc

      inc: (n: number) => number;
      • Increments its argument.

      function includes

      includes: {
      (__: Placeholder, list: readonly string[] | string): (s: string) => boolean;
      <T>(__: any, list: readonly T[]): (target: T) => boolean;
      (__: any): (list: string | readonly string[], s: string) => boolean;
      <T>(__: any): (list: readonly T[], target: T) => boolean;
      (s: string, list: string | readonly string[]): boolean;
      (s: string): (list: string | readonly string[]) => boolean;
      <T>(target: T, list: readonly T[]): boolean;
      <T>(target: T): (list: readonly T[]) => boolean;
      };
      • Given a target, this function checks a list for the target and returns a boolean. Given a string, this function checks for the string in another string or list and returns a boolean.

      function indexBy

      indexBy: {
      <T, K extends string | number = string>(fn: (a: T) => K, list: readonly T[]): {
      [key in K]: T;
      };
      <T, K extends string | number = string>(fn: (a: T) => K, list: readonly T[]): {
      [key in NonNullable<K>]?: T;
      };
      <T, K extends string | number = string>(fn: (a: T) => K): (
      list: readonly T[]
      ) => { [key in K]: T };
      <T, K extends string | number = string>(fn: (a: T) => K): (
      list: readonly T[]
      ) => { [key in NonNullable<K>]?: T };
      };
      • Given a function that generates a key, turns a list of objects into an object indexing the objects by the given key.

      function indexOf

      indexOf: {
      <T>(target: T, list: readonly T[]): number;
      <T>(target: T): (list: readonly T[]) => number;
      };
      • Returns the position of the first occurrence of an item in an array (by strict equality), or -1 if the item is not included in the array.

      function init

      init: { <T>(list: readonly T[]): T[]; (list: string): string };
      • Returns all but the last element of a list or string.

      function innerJoin

      innerJoin: {
      <T1, T2>(
      pred: (a: T1, b: T2) => boolean,
      list1: readonly T1[],
      list2: readonly T2[]
      ): T1[];
      <T1, T2>(pred: (a: T1, b: T2) => boolean): (
      list1: readonly T1[],
      list2: readonly T2[]
      ) => T1[];
      <T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (
      list2: readonly T2[]
      ) => T1[];
      };
      • Takes a predicate pred, a list xs, and a list ys, and returns a list xs' comprising each of the elements of xs which is equal to one or more elements of ys according to pred.

        pred must be a binary function expecting an element from each list.

        xs, ys, and xs' are treated as sets, semantically, so ordering should not be significant, but since xs' is ordered the implementation guarantees that its values are in the same order as they appear in xs. Duplicates are not removed, so xs' may contain duplicates if xs contains duplicates.

      function insert

      insert: {
      <T>(index: number, elt: T, list: readonly T[]): T[];
      <T>(index: number, elt: T): (list: readonly T[]) => T[];
      (index: number): <T>(elt: T, list: readonly T[]) => T[];
      };
      • Inserts the supplied element into the list, at index index. Note that this is not destructive: it returns a copy of the list with the changes.

      function insertAll

      insertAll: {
      <T>(index: number, elts: readonly T[], list: readonly T[]): T[];
      <T>(index: number, elts: readonly T[]): (list: readonly T[]) => T[];
      (index: number): <T>(elts: readonly T[], list: readonly T[]) => T[];
      };
      • Inserts the sub-list into the list, at index index. _Note that this is not destructive_: it returns a copy of the list with the changes.

      function intersection

      intersection: {
      <T>(list1: readonly T[], list2: readonly T[]): T[];
      <T>(list1: readonly T[]): (list2: readonly T[]) => T[];
      };
      • Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists.

      function intersperse

      intersperse: {
      <T>(separator: T, list: readonly T[]): T[];
      <T>(separator: T): (list: readonly T[]) => T[];
      };
      • Creates a new list with the separator interposed between elements.

      function into

      into: {
      <T>(acc: any, xf: (...a: readonly any[]) => any, list: readonly T[]): T[];
      <T, R>(acc: any, xf: (...a: readonly any[]) => R[], list: readonly T[]): R[];
      (acc: any, xf: (...a: readonly any[]) => any): <T>(list: readonly T[]) => T[];
      (acc: any): <T>(xf: (...a: readonly any[]) => any, list: readonly T[]) => T[];
      };
      • Transforms the items of the list with the transducer and appends the transformed items to the accumulator using an appropriate iterator function based on the accumulator type.

      function invert

      invert: <T>(obj: T) => { [index: string]: string[] };
      • Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array.

      function invertObj

      invertObj: (
      obj: { [index: string]: string } | { [index: number]: string }
      ) => { [index: string]: string };
      • Returns a new object with the keys of the given object as values, and the values of the given object as keys.

      function invoker

      invoker: (arity: number, method: string) => (...a: readonly any[]) => any;
      • Turns a named method with a specified arity into a function that can be called directly supplied with arguments and a target object.

        The returned function is curried and accepts arity + 1 parameters where the final parameter is the target object.

      function is

      is: { (ctor: any, val: any): boolean; (ctor: any): (val: any) => boolean };
      • See if an object (val) is an instance of the supplied constructor. This function will check up the inheritance chain, if any.

      function isEmpty

      isEmpty: (value: any) => boolean;
      • Reports whether the list has zero elements.

      function isNil

      isNil: (value: any) => value is null;
      • Checks if the input value is null or undefined.

      function join

      join: {
      (x: string, xs: readonly any[]): string;
      (x: string): (xs: readonly any[]) => string;
      };
      • Returns a string made by inserting the separator between each element and concatenating all the elements into a single string.

      function juxt

      juxt: {
      <A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (
      ...a: A
      ) => [R1, R2];
      <A extends any[], R1, R2, R3>(
      fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]
      ): (...a: A) => [R1, R2, R3];
      <A extends any[], R1, R2, R3, R4>(
      fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]
      ): (...a: A) => [R1, R2, R3, R4];
      <A extends any[], R1, R2, R3, R4, R5>(
      fns: [
      (...a: A) => R1,
      (...a: A) => R2,
      (...a: A) => R3,
      (...a: A) => R4,
      (...a: A) => R5
      ]
      ): (...a: A) => [R1, R2, R3, R4, R5];
      <A extends any[], U>(fns: ((...args: A) => U)[]): (...args: A) => U[];
      };
      • Applies a list of functions to a list of values.

      function keys

      keys: { <T extends object>(x: T): Array<keyof T>; <T>(x: T): string[] };
      • Returns a list containing the names of all the enumerable own properties of the supplied object.

      function keysIn

      keysIn: <T>(obj: T) => string[];
      • Returns a list containing the names of all the properties of the supplied object, including prototype properties.

      function last

      last: {
      (str: string): string;
      (list: readonly []): undefined;
      <T extends unknown>(list: readonly T[]): T;
      };
      • Returns the last element from a list.

      function lastIndexOf

      lastIndexOf: <T>(target: T, list: readonly T[]) => number;
      • Returns the position of the last occurrence of an item (by strict equality) in an array, or -1 if the item is not included in the array.

      function length

      length: <T>(list: readonly T[]) => number;
      • Returns the number of elements in the array by returning list.length.

      function lens

      lens: <S, A>(getter: (s: S) => A, setter: (a: A, s: S) => S) => Lens<S, A>;
      • Returns a lens for the given getter and setter functions. The getter "gets" the value of the focus; the setter "sets" the value of the focus. The setter should not mutate the data structure.

      function lensIndex

      lensIndex: {
      <A>(n: number): Lens<A[], A>;
      <A extends any[], N extends number>(n: N): Lens<A, A[N]>;
      };
      • Creates a lens that will focus on index n of the source array.

      function lensPath

      lensPath: {
      <S, K0 extends keyof S = keyof S>(path: [K0]): Lens<S, S[K0]>;
      <S, K0 extends keyof S = keyof S, K1 extends keyof S[K0] = keyof S[K0]>(
      path: [K0, K1]
      ): Lens<S, S[K0][K1]>;
      <
      S,
      K0 extends keyof S = keyof S,
      K1 extends keyof S[K0] = keyof S[K0],
      K2 extends keyof S[K0][K1] = keyof S[K0][K1]
      >(
      path: [K0, K1, K2]
      ): Lens<S, S[K0][K1][K2]>;
      <
      S,
      K0 extends keyof S = keyof S,
      K1 extends keyof S[K0] = keyof S[K0],
      K2 extends keyof S[K0][K1] = keyof S[K0][K1],
      K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2]
      >(
      path: [K0, K1, K2, K3]
      ): Lens<S, S[K0][K1][K2][K3]>;
      <
      S,
      K0 extends keyof S = keyof S,
      K1 extends keyof S[K0] = keyof S[K0],
      K2 extends keyof S[K0][K1] = keyof S[K0][K1],
      K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
      K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3]
      >(
      path: [K0, K1, K2, K3, K4]
      ): Lens<S, S[K0][K1][K2][K3][K4]>;
      <
      S,
      K0 extends keyof S = keyof S,
      K1 extends keyof S[K0] = keyof S[K0],
      K2 extends keyof S[K0][K1] = keyof S[K0][K1],
      K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
      K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
      K5 extends keyof S[K0][K1][K2][K3][K4] = keyof S[K0][K1][K2][K3][K4]
      >(
      path: [K0, K1, K2, K3, K4, K5]
      ): Lens<S, S[K0][K1][K2][K3][K4][K5]>;
      <S = any, A = any>(path: Path): Lens<S, A>;
      };
      • Returns a lens whose focus is the specified path. See also view, set, over.

      function lensProp

      lensProp: <S, K extends keyof S = keyof S>(prop: K) => Lens<S, S[K]>;
      • lensProp creates a lens that will focus on property k of the source object.

      function lift

      lift: (fn: (...a: readonly any[]) => any, ...args: readonly any[]) => any;
      • "lifts" a function of arity > 1 so that it may "map over" a list, Function or other object that satisfies the FantasyLand Apply spec.

      function liftN

      liftN: (
      n: number,
      fn: (...a: readonly any[]) => any,
      ...args: readonly any[]
      ) => any;
      • "lifts" a function to be the specified arity, so that it may "map over" that many lists, Functions or other objects that satisfy the FantasyLand Apply spec.

      function lt

      lt: {
      (__: Placeholder, b: number): (a: number) => boolean;
      (__: any): (b: number, a: number) => boolean;
      (a: number, b: number): boolean;
      (a: string, b: string): boolean;
      (a: number): (b: number) => boolean;
      };
      • Returns true if the first parameter is less than the second.

      function lte

      lte: {
      (__: Placeholder, b: number): (a: number) => boolean;
      (__: any): (b: number, a: number) => boolean;
      (a: number, b: number): boolean;
      (a: string, b: string): boolean;
      (a: number): (b: number) => boolean;
      };
      • Returns true if the first parameter is less than or equal to the second.

      function map

      map: {
      <T, U>(fn: (x: T) => U, list: readonly T[]): U[];
      <T, U>(fn: (x: T) => U): (list: readonly T[]) => U[];
      <T, U>(
      fn: (x: T[keyof T & keyof U] | ValueOfUnion<T>) => U[keyof T & keyof U],
      list: T
      ): U;
      <T, U>(
      fn: (x: T[keyof T & keyof U] | ValueOfUnion<T>) => U[keyof T & keyof U]
      ): (list: T) => U;
      <T, U>(fn: (x: T) => U, obj: Functor<T>): Functor<U>;
      <T, U>(fn: (x: T) => U): (obj: Functor<T>) => Functor<U>;
      };
      • Returns a new list, constructed by applying the supplied function to every element of the supplied list.

      function mapAccum

      mapAccum: {
      <T, U, TResult>(
      fn: (acc: U, value: T) => [U, TResult],
      acc: U,
      list: readonly T[]
      ): [U, TResult[]];
      <T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (
      acc: U,
      list: readonly T[]
      ) => [U, TResult[]];
      <T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (
      list: readonly T[]
      ) => [U, TResult[]];
      };
      • The mapAccum function behaves like a combination of map and reduce.

      function mapAccumRight

      mapAccumRight: {
      <T, U, TResult>(
      fn: (acc: U, value: T) => [U, TResult],
      acc: U,
      list: readonly T[]
      ): [U, TResult[]];
      <T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (
      acc: U,
      list: readonly T[]
      ) => [U, TResult[]];
      <T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (
      list: readonly T[]
      ) => [U, TResult[]];
      };
      • The mapAccumRight function behaves like a combination of map and reduce.

      function mapObjIndexed

      mapObjIndexed: {
      <T, TResult, TKey extends string>(
      fn: (value: T, key: TKey, obj?: Record<TKey, T>) => TResult,
      obj: Record<TKey, T>
      ): Record<TKey, TResult>;
      <T, TResult, TKey extends string>(
      fn: (value: T, key: TKey, obj?: Record<TKey, T>) => TResult,
      obj: PartialRecord<TKey, T>
      ): PartialRecord<TKey, TResult>;
      <T, TResult, TKey extends string>(
      fn: (value: T, key: TKey, obj?: Record<TKey, T>) => TResult
      ): (obj: Record<TKey, T>) => Record<TKey, TResult>;
      <T, TResult, TKey extends string>(
      fn: (value: T, key: TKey, obj?: PartialRecord<TKey, T>) => TResult
      ): (obj: Record<TKey, T>) => PartialRecord<TKey, TResult>;
      <T, TResult>(
      fn: (value: T, key: string, obj?: { [key: string]: T }) => TResult,
      obj: { [key: string]: T }
      ): { [key: string]: TResult };
      };

        function match

        match: {
        (regexp: RegExp, str: string): string[];
        (regexp: RegExp): (str: string) => string[];
        };
        • Tests a regular expression agains a String

        function mathMod

        mathMod: {
        (__: Placeholder, b: number): (a: number) => number;
        (__: any): (b: number, a: number) => number;
        (a: number, b: number): number;
        (a: number): (b: number) => number;
        };
        • mathMod behaves like the modulo operator should mathematically, unlike the % operator (and by extension, R.modulo). So while "-17 % 5" is -2, mathMod(-17, 5) is 3. mathMod requires Integer arguments, and returns NaN when the modulus is zero or negative.

        function max

        max: { <T extends Ord>(a: T, b: T): T; <T extends Ord>(a: T): (b: T) => T };
        • Returns the larger of its two arguments.

        function maxBy

        maxBy: {
        <T>(keyFn: (a: T) => Ord, a: T, b: T): T;
        <T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
        <T>(keyFn: (a: T) => Ord): any;
        };
        • Takes a function and two values, and returns whichever value produces the larger result when passed to the provided function.

        function mean

        mean: (list: readonly number[]) => number;
        • Returns the mean of the given list of numbers.

        function median

        median: (list: readonly number[]) => number;
        • Returns the median of the given list of numbers.

        function memoizeWith

        memoizeWith: <T extends (...args: readonly any[]) => any>(
        keyFn: (...v: Parameters<T>) => string,
        fn: T
        ) => T;
        • Creates a new function that, when invoked, caches the result of calling fn for a given argument set and returns the result. Subsequent calls to the memoized fn with the same argument set will not result in an additional call to fn; instead, the cached result for that set of arguments will be returned.

        function merge

        merge: {
        <O2 extends object>(__: Placeholder, b: O2): <O1 extends object>(a: O1) => any;
        (__: any): <O1 extends object, O2 extends object>(b: O2, a: O1) => any;
        <O1 extends object, O2 extends object>(a: O1, b: O2): any;
        <O1 extends object>(a: O1): <O2 extends object>(b: O2) => any;
        };
        • Create a new object with the own properties of a merged with the own properties of object b. This function will *not* mutate passed-in objects.

          Deprecated

          since 0.26 in favor of mergeRight

        function mergeAll

        mergeAll: <Os extends readonly object[]>(list: Os) => any;
        • Merges a list of objects together into one object.

        function mergeDeepLeft

        mergeDeepLeft: {
        <O1 extends object, O2 extends object>(o1: O1, o2: O2): any;
        <O1 extends object>(o1: O1): <O2 extends object>(o2: O2) => any;
        };
        • Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects: and both values are objects, the two values will be recursively merged otherwise the value from the first object will be used.

        function mergeDeepRight

        mergeDeepRight: {
        <O1 extends object, O2 extends object>(o1: O1, o2: O2): any;
        <O1 extends object>(a: O1): <O2 extends object>(o2: O2) => any;
        };
        • Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects: and both values are objects, the two values will be recursively merged otherwise the value from the second object will be used.

        function mergeDeepWith

        mergeDeepWith: {
        <T1, T2>(fn: (x: any, z: any) => any, a: T1, b: T2): any;
        <T1, T2>(fn: (x: any, z: any) => any, a: T1): (b: T2) => any;
        <T1, T2>(fn: (x: any, z: any) => any): (a: T1, b: T2) => any;
        };
        • Creates a new object with the own properties of the two provided objects. If a key exists in both objects: and both associated values are also objects then the values will be recursively merged. otherwise the provided function is applied to associated values using the resulting value as the new value associated with the key. If a key only exists in one object, the value will be associated with the key of the resulting object.

        function mergeDeepWithKey

        mergeDeepWithKey: {
        <T1, T2>(fn: (k: string, x: any, z: any) => any, a: T1, b: T2): any;
        <T1, T2>(fn: (k: string, x: any, z: any) => any, a: T1): (b: T2) => any;
        <T1, T2>(fn: (k: string, x: any, z: any) => any): (a: T1, b: T2) => any;
        };
        • Creates a new object with the own properties of the two provided objects. If a key exists in both objects: and both associated values are also objects then the values will be recursively merged. otherwise the provided function is applied to the key and associated values using the resulting value as the new value associated with the key. If a key only exists in one object, the value will be associated with the key of the resulting object.

        function mergeLeft

        mergeLeft: {
        <O1 extends object, O2 extends object>(a: O1, b: O2): any;
        <O1 extends object>(a: O1): <O2 extends object>(b: O2) => any;
        };
        • Create a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects, the value from the first object will be used.

        function mergeRight

        mergeRight: {
        <O1 extends object, O2 extends object>(a: O1, b: O2): any;
        <O1 extends object>(a: O1): <O2 extends object>(b: O2) => any;
        };
        • Create a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects, the value from the second object will be used.

        function mergeWith

        mergeWith: {
        <U, V>(fn: (x: any, z: any) => any, a: U, b: V): any;
        <U>(fn: (x: any, z: any) => any, a: U): <V>(b: V) => any;
        (fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => any;
        };
        • Creates a new object with the own properties of the two provided objects. If a key exists in both objects, the provided function is applied to the values associated with the key in each object, with the result being used as the value associated with the key in the returned object. The key will be excluded from the returned object if the resulting value is undefined.

        function mergeWithKey

        mergeWithKey: {
        <U, V>(fn: (str: string, x: any, z: any) => any, a: U, b: V): any;
        <U>(fn: (str: string, x: any, z: any) => any, a: U): <V>(b: V) => any;
        (fn: (str: string, x: any, z: any) => any): <U, V>(a: U, b: V) => any;
        };
        • Creates a new object with the own properties of the two provided objects. If a key exists in both objects, the provided function is applied to the key and the values associated with the key in each object, with the result being used as the value associated with the key in the returned object. The key will be excluded from the returned object if the resulting value is undefined.

        function min

        min: { <T extends Ord>(a: T, b: T): T; <T extends Ord>(a: T): (b: T) => T };
        • Returns the smaller of its two arguments.

        function minBy

        minBy: {
        <T>(keyFn: (a: T) => Ord, a: T, b: T): T;
        <T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
        <T>(keyFn: (a: T) => Ord): any;
        };
        • Takes a function and two values, and returns whichever value produces the smaller result when passed to the provided function.

        function modulo

        modulo: {
        (__: Placeholder, b: number): (a: number) => number;
        (__: any): (b: number, a: number) => number;
        (a: number, b: number): number;
        (a: number): (b: number) => number;
        };
        • Divides the second parameter by the first and returns the remainder. The flipped version (moduloBy) may be more useful curried. Note that this functions preserves the JavaScript-style behavior for modulo. For mathematical modulo see mathMod

        function move

        move: {
        <T>(from: number, to: number, list: readonly T[]): T[];
        (from: number, to: number): <T>(list: readonly T[]) => T[];
        (from: number): {
        <T>(to: number, list: readonly T[]): T[];
        (to: number): <T>(list: readonly T[]) => T[];
        };
        };
        • Moves an item, at index from, to index to, in a list of elements. A new list will be created containing the new elements order.

        function multiply

        multiply: { (a: number, b: number): number; (a: number): (b: number) => number };
        • Multiplies two numbers. Equivalent to a * b but curried.

        function nAry

        nAry: {
        <N extends number, T extends (...arg: any) => any>(n: N, fn: T): (
        ...arg: any
        ) => ReturnType<T>;
        <N extends number>(n: N): <T extends (...arg: any) => any>(
        fn: T
        ) => (...arg: any) => ReturnType<T>;
        };
        • Wraps a function of any arity (including nullary) in a function that accepts exactly n parameters. Any extraneous parameters will not be passed to the supplied function.

        function negate

        negate: (n: number) => number;
        • Negates its argument.

        function none

        none: {
        <T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
        <T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
        };
        • Returns true if no elements of the list match the predicate, false otherwise.

        function not

        not: (value: any) => boolean;
        • A function that returns the ! of its argument. It will return true when passed false-y value, and false when passed a truth-y one.

        function nth

        nth: {
        <T>(n: number, list: readonly T[]): T | undefined;
        (n: number): <T>(list: readonly T[]) => T;
        };
        • Returns the nth element in a list.

        function nthArg

        nthArg: (n: number) => (...a: readonly any[]) => any;
        • Returns a function which returns its nth argument.

        function o

        o: {
        <T1, T2, R>(f: (x: T2) => R, g: (x: T1) => T2, v: T1): R;
        <T1, T2, R>(f: (x: T2) => R, g: (x: T1) => T2): (v: T1) => R;
        <T2, R>(f: (x: T2) => R): {
        <T1>(g: (x: T1) => T2, v: T1): R;
        <T1>(g: (x: T1) => T2): (v: T1) => R;
        };
        };
        • o is a curried composition function that returns a unary function. Like compose, o performs right-to-left function composition. Unlike compose, the rightmost function passed to o will be invoked with only one argument. Also, unlike compose, o is limited to accepting only 2 unary functions. The name o was chosen because of its similarity to the mathematical composition operator ∘.

        function objOf

        objOf: {
        <T, K extends string>(key: K, value: T): Record<K, T>;
        <K extends string>(key: K): <T>(value: T) => Record<K, T>;
        };
        • Creates an object containing a single key:value pair.

        function of

        of: <T>(x: T) => T[];
        • Returns a singleton array containing the value provided.

        function omit

        omit: {
        <T, K extends string>(names: readonly K[], obj: T): Omit<T, K>;
        <K extends string>(names: readonly K[]): <T>(obj: T) => Omit<T, K>;
        };
        • Returns a partial copy of an object omitting the keys specified.

        function once

        once: <F extends (...a: readonly any[]) => any>(fn: F) => F;
        • Accepts a function fn and returns a function that guards invocation of fn such that fn can only ever be called once, no matter how many times the returned function is invoked. The first value calculated is returned in subsequent invocations.

        function or

        or: {
        <T, U>(a: T, b: U): T | U;
        <T>(a: T): <U>(b: U) => T | U;
        <T extends { or?: (...a: readonly any[]) => any }, U>(fn1: T, val2: U): T | U;
        <T extends { or?: (...a: readonly any[]) => any }>(fn1: T): <U>(
        val2: U
        ) => T | U;
        };
        • A function that returns the first truthy of two arguments otherwise the last argument. Note that this is NOT short-circuited, meaning that if expressions are passed they are both evaluated. Dispatches to the or method of the first argument if applicable.

        function otherwise

        otherwise: {
        <A, B>(onError: (error: any) => B | Promise<B>, promise: Promise<A>): Promise<B>;
        <A, B>(onError: (error: any) => B | Promise<B>): (
        promise: Promise<A>
        ) => Promise<B>;
        };
        • Returns the result of applying the onFailure function to the value inside a failed promise. This is useful for handling rejected promises inside function compositions.

        function over

        over: {
        <S, A>(lens: Lens<S, A>, fn: (a: A) => A, value: S): S;
        <S, A>(lens: Lens<S, A>, fn: (a: A) => A): (value: S) => S;
        <S, A>(lens: Lens<S, A>): (fn: (a: A) => A, value: S) => S;
        };
        • Returns the result of "setting" the portion of the given data structure focused by the given lens to the given value.

        function pair

        pair: { <F, S>(fst: F, snd: S): [F, S]; <F>(fst: F): <S>(snd: S) => [F, S] };
        • Takes two arguments, fst and snd, and returns [fst, snd].

        function partial

        partial: {
        <V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V0]): (x1: V1) => T;
        <V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0, V1]): (
        x2: V2
        ) => T;
        <V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0]): (
        x1: V1,
        x2: V2
        ) => T;
        <V0, V1, V2, V3, T>(
        fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T,
        args: [V0, V1, V2]
        ): (x2: V3) => T;
        <V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1]): (
        x2: V2,
        x3: V3
        ) => T;
        <V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0]): (
        x1: V1,
        x2: V2,
        x3: V3
        ) => T;
        <T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (
        ...a: readonly any[]
        ) => T;
        };
        • Takes a function f and a list of arguments, and returns a function g. When applied, g returns the result of applying f to the arguments provided initially followed by the arguments provided to g.

        function partialRight

        partialRight: {
        <V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V1]): (x1: V0) => T;
        <V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V1, V2]): (
        x2: V0
        ) => T;
        <V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V2]): (
        x1: V0,
        x2: V1
        ) => T;
        <V0, V1, V2, V3, T>(
        fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T,
        args: [V1, V2, V3]
        ): (x0: V0) => T;
        <V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V2, V3]): (
        x0: V0,
        x1: V1
        ) => T;
        <V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V3]): (
        x0: V0,
        x1: V1,
        x2: V2
        ) => T;
        <T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (
        ...a: readonly any[]
        ) => T;
        };
        • Takes a function f and a list of arguments, and returns a function g. When applied, g returns the result of applying f to the arguments provided to g followed by the arguments provided initially.

        function partition

        partition: {
        (fn: (a: string) => boolean, list: readonly string[]): [string[], string[]];
        <T>(fn: (a: T) => boolean, list: readonly T[]): [T[], T[]];
        <T>(fn: (a: T) => boolean): (list: readonly T[]) => [T[], T[]];
        (fn: (a: string) => boolean): (list: readonly string[]) => [string[], string[]];
        };
        • Takes a predicate and a list and returns the pair of lists of elements which do and do not satisfy the predicate, respectively.

        function path

        path: {
        <T>(path: Path, obj: any): T | undefined;
        <T>(path: Path): (obj: any) => T;
        };
        • Retrieve the value at a given path.

        function pathEq

        pathEq: {
        (path: Path, val: any, obj: any): boolean;
        (path: Path, val: any): (obj: any) => boolean;