Global

Members


<constant> __

Placeholder argument for curried functions.

Source:
See:

Methods


add(a, b)

A curried version of the + operator.

Parameters:
Name Type Description
a any
b any
Source:
Returns:
Type
any

adjust(index, transformFn, list)

Returns a new array with the element at the provided index
updated by the transformation function.

Parameters:
Name Type Description
index number
transformFn function
list Array.<any>
Source:
Returns:
Type
Array.<any>

all(condFn, list)

Checks if all elements of a list pass a condition.

Parameters:
Name Type Description
condFn function
list Array.<any>
Source:
Returns:
Type
boolean

allPass(functions, args)

Checks if all functions pass (return a truthy value).
The list of arguments will be applied to each function in turn (func(...args)).

Parameters:
Name Type Description
functions Array.<function()>
args Array.<any>
Source:
See:
Returns:
Type
boolean

always(arg)

Creates a nullary function that always returns the original argument.

Parameters:
Name Type Description
arg any
Source:
Returns:
Type
any

and(a, b)

A curried wrapper around the && operator.

Parameters:
Name Type Description
a any
b any
Source:
Returns:
Type
any

any(condFn, list)

Checks if any of the elements in the list pass a condition.

Parameters:
Name Type Description
condFn function
list Array.<any>
Source:
Returns:
Type
boolean

anyPass(funcs, args)

Checks if any of the functions pass (return a truthy value).
The list of arguments will be applied to each function in turn (func(...args)).

Parameters:
Name Type Description
funcs Array.<function()>
args Array.<any>
Source:
See:
Returns:
Type
boolean

ap(applyF, applyX)

Applies a list of functions to a list of values.
If functions are provided for both arguments, returns a function that's equivalent to f(x, g(x)).
Defers to the ap method of applyF, if present.

Parameters:
Name Type Description
applyF applicative | function | Array.<function()>
applyX array | function
Source:
Returns:
Type
any

append(value, list)

Appends a new element at the end of a list.

Parameters:
Name Type Description
value any
list Array.<any>
Source:
Returns:
Type
Array.<any>

apply(func, args)

Applies a list of arguments to a function.
The this variable will be set to undefined for that function execution.

Parameters:
Name Type Description
func function
args Array.<any>
Source:
Returns:
Type
any

applyTo(x, fn)

Takes a value and a function and applies the function to the value.
With curry2ing, this allows for the creation of a function that always supplies the same value for different operations.

Parameters:
Name Type Description
x any
fn function
Source:
Returns:
Type
any

arity(n, fn)

Create a new function with the specified arity between 0 and 10.

Parameters:
Name Type Description
n number
fn function
Source:
Returns:
Type
function

ascend(fn)

Creates an ascending comparator function to be used with the sort function.
The fn argument must be a unary function that returns a value
that can be compared using the > and < operators,
this value will be used for the comparison.

Parameters:
Name Type Description
fn function
Source:
See:
Returns:
Type
function

assoc(propName, value, object)

Creates a shallow copy of the object
and sets the value at propName.

Parameters:
Name Type Description
propName string
value any
object object
Source:
See:
Returns:
Type
object

assocPath(path, value, object)

Creates a shallow copy of the object and sets
the value at the specified path.
The path can be specified as a dot-separated string
or a list of strings.

Parameters:
Name Type Description
path string | Array.<string>
value any
object object
Source:
See:
Returns:
Type
object

both(f1, f2, args)

Checks if both functions return a truthy value.
The arguments are applied to each function in turn (func(...args)).

Parameters:
Name Type Description
f1 function
f2 function
args Array.<any>
Source:
See:
Returns:
Type
boolean

chain(fn, list)

Maps a function over a list and concatenates the results.
Dispatches to the chain method of the second argument, if one exists.

Parameters:
Name Type Description
fn function
list Array.<any>
Source:
Returns:
Type
Array.<any>

chunk(size, list)

Splits a list into a groups of smaller lists with the provided size.

chunk(2, [1, 2, 3, 4, 5, 6, 7]);
// returns:
// [[1, 2], [3, 4], [5, 6], [7]]
Parameters:
Name Type Description
size number
list Array.<any>
Source:
Returns:
Type
Array.<any>

clamp(min, max, value)

Clamps a number to fit in a range.

Parameters:
Name Type Description
min number
max number
value number
Source:
Returns:
Type
number

complement(func)

Creates a complementing funciton.
The new function will return true when the original function would have returned a falsy value
and false - when the original function would have returned a truthy value.

Parameters:
Name Type Description
func funciton
Source:
Returns:
Type
function

compose(funcs)

Takes a variable list of functions and returns a new function
that is a composition of all the functions that were passed.
The functions are called right-to-left.
The right-most function may have any arity, while the rest must be unary.
An example with three functions (f, g, h) => (...args) => h(g(f(...args)))

Parameters:
Name Type Argument Description
funcs function <repeatable>
Source:
Returns:
Type
function

concat(left, right)

Concatenates 2 strings or 2 arrays.

Parameters:
Name Type Description
left string | array
right string | array
Source:
Returns:
Type
string | array

cond(pairs, arg)

Works a bit like the switch structure.
Contains pairs condition and transform functions.
The first condition function that returns a truthy value will cause its paired transform function to be called.
Both the condition and transform functions are passed the arg param.
The pairs argument's format should look like this:

[
  [x => x > 5, x => x + 5],
  [x => x < 5, x => x - 5],
  [() => true, x => x],
]

If you have the last pair's condition function always return true,
it will work like the default case in a switch statement.
If you don't have a default case and none of the condition functions pass,
then the funciton will return undefined.

Parameters:
Name Type Description
pairs Array.<any>
arg any
Source:
Returns:
Type
any

construct(classFn)

Creates a curried version of a constructor function.
The resulting function does not need the use of the new keyword.
The constructor function can only take up to 10 arguments.

Parameters:
Name Type Description
classFn function
Source:
Returns:
Type
function

constructN(n, classFn)

Creates a curried constructor, like construct,
but also takes the constructor's arity as its first argument.

Parameters:
Name Type Description
n number
classFn function
Source:
See:
Returns:
Type
function

converge(convergingFn, branchingFns)

Takes a list of functions and a converging function.
Returns a new function that takes a variable number of arguments,
which will be applied to each of the branching functions.
The results of the branching functions will be passed to the converging function.

Parameters:
Name Type Description
convergingFn function
branchingFns Array.<function()>
Source:
Returns:
Type
function

curry(func)

Curries the provided function.
A curried function does not need to have all of its arguments provided at once.
If f is a ternary and g = curry(f), then the following is equivalent:

g(1)(2)(3);
g(1)(2, 3);
g(1, 2)(3);
g(1, 2, 3);

Additionaly, the F.__ symbol can be used as a placeholder argument,
when you want to partially apply arguments with gaps inbetween them.

g(1, __, 3)(2);
g(__, __, 3)(1, 2);
g(__, __, 3)(__, 2)(1);
Parameters:
Name Type Description
func function
Source:
Returns:
Type
function

curry1(fn)

A simplified curry for single-argument functions.

Parameters:
Name Type Description
fn function
Source:
Returns:
Type
function

curry2(fn)

A simplified curry for binary functions.

Parameters:
Name Type Description
fn function
Source:
Returns:
Type
function

dec(num)

Decrements a number.

Parameters:
Name Type Description
num number
Source:
Returns:
Type
number

defaultTo(def, value)

If value is nil, then the default value will be returned,
otherwise value will be returned.
Check isNil to see which values are considered nil.

Parameters:
Name Type Description
def any
value any
Source:
See:
Returns:
Type
any

descend(fn)

Creates a descending comparator function to be used with the sort function.
The fn argument must be a unary function that returns a value
that can be compared using the > and < operators,
this value will be used for the comparison.

Parameters:
Name Type Description
fn function
Source:
See:
Returns:
Type
function

difference(list1, list2)

Returns a unique list of elements from list1 that are not present in list2.
Comparison is done using the equals function.

Parameters:
Name Type Description
list1 Array.<any>
list2 Array.<any>
Source:
See:
Returns:
Type
Array.<any>

differenceWith(equalsFn, list1, list2)

Returns a unique list of elements from list1 that are not present in list2.
Comparison is done using the binary function argument - equalsFn.

Parameters:
Name Type Description
equalsFn function
list1 Array.<any>
list2 Array.<any>
Source:
See:
Returns:
Type
Array.<any>

dissoc(prop, object)

Creates a shallow copy of the object
with the element at prop removed.

Parameters:
Name Type Description
prop string
object object
Source:
See:
Returns:
Type
object

dissocPath(path, object)

Creates a shallow copy of the object
with the element at the specified path removed.

Parameters:
Name Type Description
path string | Array.<string>
object object
Source:
See:
Returns:
Type
object

divide(divisor, divident)

A curried version of the / operator.
Throws an error when trying to divide by zero.

Parameters:
Name Type Description
divisor number
divident number
Source:
Returns:
Type
number

drop(index, list)

Creates a new array with the element at the specified index removed.

Parameters:
Name Type Description
index number
list Array.<any>
Source:
Returns:
Type
Array.<any>

either(f1, f2, args)

Returns true if either one of the functions returns a truthy value with the provided arguments.
The arguments are applied to each function in turn(func(...args)).

Parameters:
Name Type Description
f1 function
f2 function
args Array.<any>
Source:
Returns:
Type
boolean

equals(left, right)

Checks if the two arguments are equal
according to the strict equality comparison(===).
Defers to left.equals(right) if such a method exists.

Parameters:
Name Type Description
left any
right any
Source:
Returns:
Type
boolean

evolve(spec, object)

Creates a new object by going through the spec object/list recursively
and transforming the corresponding element in the target object.

Parameters:
Name Type Description
spec object | Array.<any>
object object | Array.<any>
Source:
Returns:
Type
object | Array.<any>

F()

A utility function that always returns false regardless of its arguments.

Source:
Returns:
Type
boolean

filter(func, list)

Filters the elements of an array, object or string
and returns a new array, object or string respectively.

Parameters:
Name Type Description
func function
list array | string | object
Source:
Returns:
Type
array | string | object

find(condFn, list)

Returns the first element of a list that passes the condition function.

Parameters:
Name Type Description
condFn function
list Array.<any> | object
Source:
Returns:
Type
any

findIndex(condFn, list)

Returns the index of the first element that
passes the condition function or -1 if no element is found.

Parameters:
Name Type Description
condFn function
list Array.<any>
Source:
Returns:
Type
number

findLast(condFn, list)

Returns the last element in the list that pases the condition function.

Parameters:
Name Type Description
condFn function
list Array.<any>
Source:
See:
Returns:
Type
any

findLastIndex(condFn, list)

Finds the index of the last element that passes the condition function.
Retruns -1 if no element matches the condition.

Parameters:
Name Type Description
condFn function
list Array.<any>
Source:
See:
Returns:
Type
number

flatten(list)

Returns a new list with all nested arrays flattened.

Parameters:
Name Type Description
list Array.<any>
Source:
See:
Returns:
Type
Array.<any>

flip(func)

Creates a new function that takes its arguments
in reverse order of the original function.

Parameters:
Name Type Description
func function
Source:

forEach(fn, list)

Runs a function for each element of the list, object or string.

Parameters:
Name Type Description
fn function
list Array.<any> | object | string
Source:
Returns:
Type
undefined

groupBy(groupFn, list)

Groups the elements of a list into an object
where the group of each element is determined by the grouping/key function.
The resulting object has the following format:

{
  "group1": [el, el2, el3], // elements for which `groupFn` returned `group1`
  "group2": [el4, el5], // elements for which `groupFn` returned `group2`
  // ...
}
Parameters:
Name Type Description
groupFn function
list Array.<any>
Source:
Returns:
Type
object

gt(right, left)

A curried wrapper around the > operator.

Parameters:
Name Type Description
right any
left any
Source:
Returns:
Type
boolean

gte(right, left)

A curried wrapper around the >= operator.

Parameters:
Name Type Description
right any
left any
Source:
Returns:
Type
boolean

has(prop, object)

Checks an object contains a prop.

Parameters:
Name Type Description
prop string
object object
Source:
Returns:
Type
boolean

hasPath(path, object)

Checks if a prop at at the given path exists.
The path can be given as a dot-separated string or a list of strings.

Parameters:
Name Type Description
path string | Array.<string>
object object
Source:
Returns:
Type
boolean

Returns the first element of a list or string.

Parameters:
Name Type Description
list Array.<any> | string
Source:
Returns:
Type
any | string

identity(a)

The identity function just returns its first argument.

Parameters:
Name Type Description
a any
Source:
Returns:
Type
any

inc(number)

Increments a number.

Parameters:
Name Type Description
number number
Source:
Returns:
Type
number

includes(element, fromIndex, list)

Checks if the list includes element, starting from fromIndex.
Defers to Array.prototype.includes

Parameters:
Name Type Description
element any
fromIndex number
list Array.<any>
Source:
Returns:
Type
boolean

indexOf(search, fromIndex, str)

Finds the index of the first match, or -1 if there's no match.

Parameters:
Name Type Description
search string
fromIndex integer
str string
Source:
Returns:
Type
number

inRange(min, max, value)

Checks if a number is within range.
The lower boundary is inclusive and upper boundary is exclusive.

Parameters:
Name Type Description
min number
max number
value number
Source:
Returns:
Type
boolean

insert(index, value, list)

Inserts an element at the specified index, pushing the following elements back.

Parameters:
Name Type Description
index number
value any
list Array.<any>
Source:

intersection(list1, list2)

Finds the intersection of two lists.
Uses the equals function for comparison.

Parameters:
Name Type Description
list1 Array.<any>
list2 Array.<any>
Source:
See:
Returns:
Type
Array.<any>

intersectionWith(equalsFn, list1, list2)

Finds the intersection of two lists.
Uniqueness is determined by the equalsFn,
which takes an element from each list
and must return true if the two elements are considered equal.

Parameters:
Name Type Description
equalsFn function
list1 Array.<any>
list2 Array.<any>
Source:
See:
Returns:
Type
Array.<any>

isEmpty(arg)

Checks if the value is empty.
Empty values are [], {} and ''.

Parameters:
Name Type Description
arg any
Source:
Returns:
Type
boolean

isNil(arg)

Checks if a value is nil.
A value is considered nil if it's null, undefined or NaN.

Parameters:
Name Type Description
arg any
Source:
Returns:
Type
boolean

join(glue, list)

Joins the elements of a list into a string
with the "glue" string inbetween each element.
Defers to Array.prototype.join

Parameters:
Name Type Description
glue *
list *
Source:

keys(obj)

Returns all own enumerable property names and symbols.

Parameters:
Name Type Description
obj object
Source:
Returns:
Type
Array.<any>

keyWith(keyFn, list)

Creates an object whose keys are determined by keyFn.
Each element of the list will be assigned in the object based on the key generated.
If the key function returns the same values for 2 elements from the list,
the one that's later in the list will overwrite the earlier one.
This function is useful if you have an array of objects that you want to convert to an object.

Parameters:
Name Type Description
keyFn function
list Array.<any>
Source:
Returns:
Type
object

lens(getter, setter)

Takes a set of getter/setter functions
and wraps them in a lens object, that focuses on a specific part of a larger data object.
The lens should be used with the view, set and over functions.
The lens should not be used on its own
as its internal implementation should be treated as a black box.

The getter and setter functions should not modify the original data object.
The getter should be a unary function with the data as its only argument.
The setter function should be a binary function that receives the new value as its first argument
and the data object as its second argument.

Parameters:
Name Type Description
getter function
setter function
Source:
See:
Returns:
Type
object

lensIndex(index)

Creates a lens that will focus on a specific list index.

Parameters:
Name Type Description
index integer
Source:
See:
Returns:
Type
object

lensPath(path)

Creates a lens that will focus on a specific object path.
The path is specified the same way as in the path function.

Parameters:
Name Type Description
path string | Array.<string>
Source:
See:
Returns:
Type
object

lt(right, left)

A curried wrapper around the < operator.

Parameters:
Name Type Description
right any
left any
Source:
Returns:
Type
boolean

lte(right, left)

A curried wrapper around the <= operator.

Parameters:
Name Type Description
right any
left any
Source:
Returns:
Type
boolean

map(func, list)

Maps over a list, object or string and returns a new object of the corresponding type.
Each element of the collection is passed through the mapping function
and its return value is used for the new collection.
The mapping function receives (value, key, list),
where list is the full list, object or string.
Defers to Array.prototype.map for lists

Parameters:
Name Type Description
func function
list Array.<any> | object | string
Source:
Returns:
Type
Array.<any> | object | string

mapIOInner(fn, ioInner)

Maps the inner value of a IO.

Parameters:
Name Type Description
fn function
ioInner IO
Source:
Returns:
Type
IO

match(regex, str)

Matches the regular expression with the string and returns the match results.

Parameters:
Name Type Description
regex RegExp
str string
Source:
Returns:
Type
Array.<string> | null

memoizeWith(keyGenerator, func)

Memoizes a function where the key generator function
decides which cached result should be returned.

Parameters:
Name Type Description
keyGenerator function
func function
Source:

modulo(b, a)

A curried version of the modulo % operator (a % b).

Parameters:
Name Type Description
b number
a number
Source:
Returns:
Type
number

multiply(a, b)

A curried version of the * operator.

Parameters:
Name Type Description
a number
b number
Source:
Returns:
Type
number

not(arg)

A curried wrapper around the ! operator.

Parameters:
Name Type Description
arg any
Source:
Returns:
Type
boolean

nth(n, list)

Returns the nth element of a list.

Parameters:
Name Type Description
n number
list Array.<any>
Source:
Returns:
Type
any

nthArg(index)

Takes an index and returns a function
that will return the argument with that index.
If the index is negative, then the argument will
be returned from the end of the argument list,
where -1 is the last argument.

Parameters:
Name Type Description
index number
Source:
Returns:
Type
function

of(arg)

Wraps an argument in an array

Parameters:
Name Type Description
arg any
Source:
Returns:
Type
Array.<any>

or(a, b)

A curried wrapper around the || operator.

Parameters:
Name Type Description
a any
b any
Source:
Returns:
Type
any

over(lens, transformFn, data)

Runs the transform function over the part of the data that the lens is focusing on.

Parameters:
Name Type Description
lens object
transformFn function
data any
Source:
See:
Returns:
Type
any

path(path, object)

Returns the element at the specified path.
The path can be provided as a dot-separated string or as a list of strings.

Parameters:
Name Type Description
path string | Array.<string>
object object
Source:
Returns:
Type
any

pathOr(defaultValue, path, object)

Returns the value at the given path or a default value if the path doesn't exist.
The path can be specified as a dot-separated string or a list of strings.

Parameters:
Name Type Description
defaultValue any
path string | Array.<string>
object object
Source:
Returns:
Type
object

pathSatisfies(condFn, path, object)

Checks if the value at the specified path passes the condition.
The path can be provided as a dot-separated string or a list of strings.

Parameters:
Name Type Description
condFn function
path string | Array.<string>
object object
Source:
Returns:
Type
boolean

pick(props, object)

Filters an object by only copying values that are in the props list.

Parameters:
Name Type Description
props Array.<string>
object object
Source:
Returns:
Type
object

pipe(funcs)

Takes a variable list of functions and returns a new function
that is a composition of all the functions that were passed.
The functions are called left-to-right.
The left-most function may have any arity, while the rest must be unary.
An example with three functions (f, g, h) => (...args) => f(g(h(...args)))

Parameters:
Name Type Argument Description
funcs function <repeatable>
Source:
Returns:
Type
function

pluck(path, list)

Takes a list of objects and returns a new list with the values at the specified path plucked.
The path can be provided with a dot-separated string or a list of strings,
same as the path* functions.

Parameters:
Name Type Description
path string | Array.<string>
list Array.<object>
Source:
See:
Returns:
Type
Array.<any>

prepend(value, list)

Prepends a value at the beginning of a list.

Parameters:
Name Type Description
value any
list Array.<any>
Source:
Returns:
Type
Array.<any>

prop(propName, object)

Retruns the prop with the specified key.

Parameters:
Name Type Description
propName string
object object
Source:
Returns:
Type
any

propEq(propName, value, object)

Checks if the prop equals the specified value.
The comparisson is done using the equals function.

Parameters:
Name Type Description
propName string
value any
object object
Source:
Returns:
Type
boolean

propOr(defaultValue, propName, object)

Returns object[prop] if it exists or defaultValue otherwise.

Parameters:
Name Type Description
defaultValue any
propName string
object object
Source:
Returns:
Type
any

propSatisfies(conditionFn, propName, object)

Checks if the prop satisfies the condition function.

Parameters:
Name Type Description
conditionFn function
propName string
object object
Source:
Returns:
Type
boolean

range(from, to)

Returns a list of numbers from the first argument(inclusive)
to the second argument(exclusive).

Parameters:
Name Type Description
from number
to number
Source:
Returns:
Type
Array.<number>

reduce(func, initialValue, list)

Reduces a list, object or string to a single value output value.
The reducer function receives the following arguments (accumulator, currentValue, key, list),
where list is the whole list, object or string.

Parameters:
Name Type Description
func function
initialValue any
list Array.<any> | object | string
Source:
Returns:
Type
any

reduceWhile(condFn, reducer, initialValue, list)

Similar to reduce, but it will terminate early if the condFn returns false.
The condition function receives the same arguments as the reducer.
See the reduce function for details on the reducer arguments.

Parameters:
Name Type Description
condFn function
reducer function
initialValue any
list Array.<any> | object | string
Source:
See:
Returns:
Type
any

regexTest(regex, str)

Tests a string vs a regular expression.

Parameters:
Name Type Description
regex RegExp
str string
Source:
Returns:
Type
boolean

replace(search, replacement, string)

Replaces

Parameters:
Name Type Description
search string | RegExp
replacement string | function
string string
Source:
Returns:
Type
string

reverse(listOrStr)

Returns a new list or string (depending on the argument)
with its order reversed.

Parameters:
Name Type Description
listOrStr Array.<any> | string
Source:
Returns:
Type
Array.<any> | string

set(lens, value, data)

Sets the value that the lens is focusing on by calling the lens setter.

Parameters:
Name Type Description
lens object
value any
data any
Source:
See:
Returns:
Type
any

size(collection)

Returns the size of a list, object or string.
For lists and strings, it will just return the length property.
For objects - returns the sum of the counts of its own property names
and its own property symbols.

Parameters:
Name Type Description
collection Array.<any> | object | string
Source:
Returns:
Type
number

slice(begin, end, list)

Slices an array from begin to end.
Defers to the list.slice method.
See the documentation about Array.prototype.slice
and String.prototype.slice

Parameters:
Name Type Description
begin number
end number
list Array.<any> | string
Source:
Returns:
Type
Array.<any> | string

sort(predicate, list)

Returns a new list that's sorted according to the predicate.
Uses Array.prototype.sort
for the sorting, please refer to its documentation for the arguments that the predicate receives.
Note however that the sorting is done on a shallow copy of the original list.

Parameters:
Name Type Description
predicate function
list Array.<any>
Source:
Returns:
Type
Array.<any>

splice(index, deleteCount, newElements, list)

Creates a shallow copy of the list and splices it,
deleting deleteCount items at the specified index (can be zero),
and inserting newElements in that place.
Notice that newElements can also be an empty list.
Unlike Array.prototype.splice, it receives its new elements as a list instead of
Rest parameters

Reference: Array.prototype.splice

Parameters:
Name Type Description
index number
deleteCount number
newElements Array.<any>
list Array.<any>
Source:
Returns:
Type
Array.<any>

split(delimiter, string)

Splits a string into a list of strings based on a delimiter.

Parameters:
Name Type Description
delimiter string
string string
Source:
Returns:
Type
Array.<string>

subtract(b, a)

A curried version of the - operator.

Parameters:
Name Type Description
b number
a number
Source:
Returns:
Type
number

T()

A utility function that always returns true regardless of its arguments.

Source:
Returns:
Type
boolean

tail(list)

Returns all elements from a list or string, except the first one.

Parameters:
Name Type Description
list Array.<any> | string
Source:
Returns:
Type
Array.<any> | string

take(n, list)

Takes the first n elements of a list,
where n is the number of elements to take.
The original list is left unchanged.

Parameters:
Name Type Description
n number
list Array.<any>
Source:
Returns:
Type
Array.<any>

takeLast(numElements, list)

Similar to take, but takes elements from the end of the list.

Parameters:
Name Type Description
numElements number
list Array.<any>
Source:
See:
Returns:
Type
Array.<any>

tap(func, arg)

Runs a function on an argument and returns the argument.

Parameters:
Name Type Description
func function
arg any
Source:
Returns:
Type
any

thunkify(func)

Returns a new function that delays execution by returning a nullary function.

Parameters:
Name Type Description
func function
Source:
Returns:
Type
function

times(fn, n)

Executes fn n times and returns its results as a list.
The predicate is passed the current iteration number as its only argument,
which ranges from 0 to n - 1.

Parameters:
Name Type Description
fn function
n integer
Source:
Returns:
Type
Array.<any>

toAsyncEither()

Executes a function that returns a promise and wraps its result in a Right.
If an exception is thrown it's caught and returned wrapped in a Left.

Parameters:
Type Description
function
array
Source:
Returns:
Type
Promise.<Either>

toEither(fn, args)

Executes a function and wraps its result in a Right.
If an exception is thrown it's caught and returned wrapped in a Left.

Parameters:
Name Type Description
fn function
args array
Source:
Returns:
Type
Left | Right

toIOEither(fn, args)

Wraps a function in IO and Either.

Parameters:
Name Type Description
fn function
args array
Source:
Returns:
Type
IO.<Either>

toLower(str)

Converts a string to lower case.

Parameters:
Name Type Description
str string
Source:
Returns:
Type
string

toUpper(str)

Converts a string to upper case.

Parameters:
Name Type Description
str string
Source:

trim(str)

Trims whitespace at the beginning and end of a string.

Parameters:
Name Type Description
str string
Source:

unapply(func)

Creates a variadic function from a unary function that accepts a list.

Parameters:
Name Type Description
func function
Source:
Returns:
Type
function

unfold(fn, seed)

Generates a list based on a seed and an iterator function.
The iterator function accepts a single argument - a seed.
The iterator needs to return either false to stop the generation or an array of 2 elements.
The first element in the array is the value that's going to be appended to the result,
while the second element is the seed for the next iteration.

Parameters:
Name Type Description
fn function
seed any
Source:
Returns:
Type
Array.<any>

union(list1, list2)

Returns the union of the two lists.
Uses the equals function to compare if two values are equal.

Parameters:
Name Type Description
list1 Array.<any>
list2 Array.<any>
Source:
See:
Returns:
Type
Array.<any>

unionWith(equalsFn, list1, list2)

Returns the union of two lists.
Comparisson is done with the equalsFn,
which is given two elements and must return true if they are considered equal.

Parameters:
Name Type Description
equalsFn function
list1 Array.<any>
list2 Array.<any>
Source:
See:
Returns:
Type
Array.<any>

unique(list)

Returns a new list with duplicate values removed.
The comparison is done with the equals function.

Parameters:
Name Type Description
list Array.<any>
Source:
See:
Returns:
Type
Array.<any>

unless(conditionFn, elseFn, arg)

Returns the result of elseFn(arg) only if conditionFn(arg) returns a falsy value,
otherwise returns the argument unchanged.

Parameters:
Name Type Description
conditionFn function
elseFn function
arg any
Source:
See:
Returns:
Type
any

unnest(list)

Removes one level of list nesting.

Parameters:
Name Type Description
list Array.<any>
Source:
See:
Returns:
Type
Array.<any>

update(index, value, list)

Returns a new array with the value at the specified index updated.

Parameters:
Name Type Description
index integer
value any
list Array.<any>
Source:

values(obj)

Returns the values of all own enumerable property names and symbols.

Parameters:
Name Type Description
obj object
Source:
Returns:
Type
Array.<any>

view(lens, data)

Returns the specific part of the data that the lens is focusing on.

Parameters:
Name Type Description
lens object
data any
Source:
See:
Returns:
Type
any

when(conditionFn, thenFn, arg)

Returns the result of thenFn(arg) only if conditionFn(arg) returns a truthy value,
otherwise returns the argument unchanged.

Parameters:
Name Type Description
conditionFn function
thenFn function
arg any
Source:
See:
Returns:
Type
any

where(specObject, testObject)

Checks if all of the condition functions in the spec object pass.

Parameters:
Name Type Description
specObject object
testObject object
Source:
Returns:
Type
boolean

without(values, list)

Removes a list of values from the target list.
Equality comparisson is made with the equals function.

Parameters:
Name Type Description
values Array.<any>
list Array.<any>
Source:
See:
Returns:
Type
Array.<any>

xor(a, b)

A curried wrapper around the ^ operator.

Parameters:
Name Type Description
a any
b any
Source:

zip(list1, list2)

Creates a new list with pairs of values from the 2 lists,
where each pair consists of the element with the same index from each array.
If one list has more elements than the other,
then the pairing will be done up to the lenght of the shorter array.
The resulting array has the following format:

[
  [list1el1, list2el1],
  [list1el2, list2el2],
  // ...
]
Parameters:
Name Type Description
list1 Array.<any>
list2 Array.<any>
Source:

zipObj(keys, values)

Similar to zip, but the elements of the first list are used for keys
and the values of the second list are used as values for the resulting object.
The format of the resulting object is the following:

{
  [list1el1]: list2el1,
  [list1el2]: list2el2,
  // ...
}
Parameters:
Name Type Description
keys Array.<any>
values Array.<any>
Source:
See:
Returns:
Type
object