Home Reference Source

References

summary
public

F assign(sources: *): *

Create a new object/array with the own properties of the first entry merged with the own properties of the others objects.

public

F clone(x: *): *

Creates a deep copy of the value which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.

public

F defaultTo(dflt: a, x: b): *

Autocurry for 2 arguments

Returns the second argument if it is not null, undefined or NaN otherwise the first argument is returned.

public

F isTrue(val: *): boolean

Returns true if val is true or equal to string 'true'

public

Negates its argument.

public

F not(val: *): Boolean

A function that returns the ! of its argument.

public

F type(x: *): String

Gives a single-word string description of the (native) type of a value, returning such answers as 'Object', 'Number', 'Array', or 'Null'.

public

Generates a unique ID.

array

summary
public

F adjust(fn: Function, idx: Number, list: Array): Array

Autocurry for 3 arguments

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.

public

F all(fn: Function, arr: Array): Boolean

Autocurry for 2 arguments

Returns true if all the elements of the array match the predicate, false otherwise.

public

F any(fn: Function, arr: Array): Boolean

Autocurry for 2 arguments

Returns true if at least one of elements of the list match the predicate, false otherwise.

public

F append(el: *, list: Array): Array

Autocurry for 2 arguments

Returns a new list containing the contents of the given list, followed by the given element.

public

Autocurry for 2 arguments

Returns the result of concatenating the given arrays or strings.

public

Autocurry for 2 arguments

Returns the array of all elements in the first array not contained in the second array.

public

F drop(n: Number, xs: *): *

Autocurry for 2 arguments

Returns all but the first n elements of the given list, string.

public

F dropLast(n: Number, xs: Array): Array

Autocurry for 2 arguments

Returns a list containing all but the last n elements of the given list.

public

F dropWhile(fn: Function, arr: Array): Array

Autocurry for 2 arguments

Returns a new list excluding the leading elements of a given list which satisfy the supplied predicate function.

public

F each(fn: Function, arr: Array)

Autocurry for 2 arguments

Iterate over an input list, calling a provided function fn for each element in the list.

public

F filter(fn: Function, arr: Array): Array

Autocurry for 2 arguments

Takes a predicate and a "arr", and returns a new array of the same type containing the members of the given arr which satisfy the given predicate.

public

F filterMap(filterFn: Function, mapFn: Function, arr: Array): Array

Autocurry for 3 arguments

This is shortcut for filter + map, but applied in one iteration.

public

F find(fn: Function, arr: Array): Object

Autocurry for 2 arguments

Returns the first element of the list which matches the predicate, or undefined if no element matches.

public

F findIndex(fn: Function, arr: Array): Number

Autocurry for 2 arguments

Returns the index of the first element of the list which matches the predicate, or -1 if no element matches.

public

F findLast(fn: Function, list: Array): Object

Autocurry for 2 arguments

Returns the last element of the list which matches the predicate, or undefined if no element matches.

public

F flatten(arr: Array): Array

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.

public

F groupBy(fns: Array<Function>, list: Array): Array

Autocurry for 2 arguments

Creates an array of arrays generated from the results of running each element of list thru each fn.

public

F head(arr: Array): *

Returns the first element of the given array.

public

F includes(value: *, arr: Array | String): Boolean

Autocurry for 2 arguments

Dispatches call to arr.indexOf, returns true if arr is array and value in the array or if arr is string and value is substring of arr

public

F indexBy(fn: Function, arr: Array): Object

Autocurry for 2 arguments

Given a function that generates a key, turns a list of objects into an object indexing the objects by the given key.

public

F indexOf(target: *, xs: Array): Number

Autocurry for 2 arguments

Returns the position of the first occurrence of an item in an array, or -1 if the item is not included in the array.

public

F init(arr: Array): *

Returns all but the last element of the given list or string.

public

Autocurry for 2 arguments

Combines two array into a set (i.e.

public

F join(separator: String, arr: Array): String

Autocurry for 2 arguments

Returns a string made by inserting the separator between each element and concatenating all the elements into a single string.

public

F last(arr: Array): *

Returns the last element of the given array.

public

F length(arr: Array): Number

Returns the number of elements in the array by returning arr.length.

public

F map(fn: Function, arr: Array): Array

Autocurry for 2 arguments

Creates an array of values by running each element in list through fn.

public

F maxBy(fn: Function, arr: Array): *

Autocurry for 2 arguments

Return max value in array, depending on result of calling fn

public

F nth(index: Number, arr: *): *

Autocurry for 2 arguments

Returns the nth element of the given array.

public

F partition(fn: Function, arr: Array): Array

Autocurry for 2 arguments

Takes a predicate and a array and returns the pair of arrays of the same type of elements which do and do not satisfy, the predicate, respectively.

public

F pluck(key: String, arr: Array): Array

Autocurry for 2 arguments

Returns a new list by plucking the same named property off all objects in the list supplied.

public

F range(a: number, b: number, step: number): Array

Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.

public

F reduce(fn: Function, acc: *, arr: Array): *

Autocurry for 3 arguments

Returns a single item by iterating through the list, successively calling the iterator function and passing it an accumulator value and the current value from the array, and then passing the result to the next call.

public

F reduceWhile(pred: Function, fn: Function, acc: *, arr: Array): *

Autocurry for 4 arguments

Returns a single item by iterating through the list, successively calling the iterator function.

public

F reject(fn: Function, arr: Array): Array

Autocurry for 2 arguments

Takes a predicate and a "arr", and returns a new array of the same type containing the members of the given arr which do not satisfy the given predicate.

public

F remove(start: Number, count: Number, list: Array): *

Autocurry for 3 arguments

Removes the sub-list of list starting at index start and containing count elements.

public

F repeat(n: Number, value: *): Array

Autocurry for 2 arguments

Returns a fixed list of size n containing a specified identical value.

public

F reverse(list: Array | String): Array | String

Returns a new list or string with the elements or characters in reverse order.

public

F shuffle(arr: Array): Array

Creates an array of shuffled values

public

F slice(fromIndex: Number, toIndex: Number, list: Array | String): Array | String

Autocurry for 3 arguments

Returns the elements of the given list or string (or object with a slice method) from fromIndex (inclusive) to toIndex (exclusive).

public

F sort(comparator: Function, arr: Array): Array

Autocurry for 2 arguments

Returns a copy of the array, sorted according to the comparator function, which should accept two values at a time and return a negative number if the first value is smaller, a positive number if it's larger, and zero if they are equal. Please note that this is a copy of the list. It does not modify the original.

public

F sortBy(fn: Function, arr: Array): Array

Autocurry for 2 arguments

Sorts the array according to the supplied function.

public

F splitEvery(length: Number, arr: Array | String): Array[] | String[]

Autocurry for 2 arguments

Splits a collection into slices of the specified length

public

Autocurry for 2 arguments

Sorts the array according to the supplied function and keeping the order of elements.

public

F sum(arr: Array): Number

Adds together all the elements of a list.

public

F tail(arr: Array): *

Returns all but the first element of the given array.

public

F take(n: Number, arr: Array | String): *

Autocurry for 2 arguments

Returns the first n elements of the given array or string

public

Autocurry for 2 arguments

Returns a new array|string containing the last n elements of a given array|string, passing each value to the supplied predicate function, and terminating when the predicate function returns false.

public

F toArray(val: *): Array

Converts val to array.

public

F uniq(arr: Array): Array

Returns unique items in array

public

F uniqBy(fn: Function, arr: Array): Array

Autocurry for 2 arguments

Returns unique items in array.

public

F update(idx: Number, x: *, list: Array): Array

Autocurry for 3 arguments

Returns a new copy of the array with the element at the provided index replaced with the given value.

public

F without(xs: Array, list: Array): Array

this function was deprecated. use array/difference instead

Autocurry for 2 arguments

Returns a new list without values in the first argument.

public

F zip(a: Array, b: Array): Array

Autocurry for 2 arguments

Creates a new list out of the two supplied by pairing up equally-positioned items from both lists.

public

F zipWith(fn: Function, a: Array, b: Array): Array

Autocurry for 3 arguments

Creates a new list out of the two supplied by applying the function to each equally-positioned pair in the lists.

function

summary
public

F F(): Boolean

A function that always returns false.

public

F T(): Boolean

A function that always returns true.

public

F allPass(fns: Array, args: ...*): Function

Autocurry for 2 arguments

Takes a list of predicates and returns a predicate that returns true for a given list of arguments if every one of the provided predicates is satisfied by those arguments.

public

F always(x: *): Function

Returns a function that always returns the given value.

public

F anyPass(fns: Array, args: ...*): Function

Autocurry for 2 arguments

Takes a list of predicates and returns a predicate that returns true for a given list of arguments if at least one of the provided predicates is satisfied by those arguments.

public

F applyOrReturn(args: Array, test: *): *

Autocurry for 2 arguments

If test is function it calls with applied first argument, otherwise just returns test

public

Autocurry for 2 arguments

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.

public

Makes a comparator function out of a function that reports whether the first element is less than the second.

public

Takes a function f and returns a function g such that if called with the same arguments when f returns a "truthy" value, g returns false and when f returns a "falsy" value g returns true.

public

F compose(fns: ...Function): Function

Performs right-to-left function composition.

public

F composeP(chain: ...Function): Function

Performs right-to-left composition of Promise-returning functions.

public

F cond(pairs: F): Function

Returns a function, fn, which encapsulates if/else-if/else logic.

public

Returns a curried equivalent of the provided function.

public

F curryN(arity: Number, fn: Function): Function

Returns a curried equivalent of the provided function, with the specified arity.

public

F debounce(wait: number, fn: Function): Function

Autocurry for 2 arguments

Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked.

public

Autocurry for 2 arguments

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.

public

F flip(fn: Function): *

Returns a new function much like the supplied one, except that the first two arguments' order is reversed.

public

F identity(x: *): *

A function that does nothing but return the parameter supplied to it.

public

F ifElse(condition: Function, onTrue: Function, onFalse: Function): Function

Autocurry for 3 arguments

Creates a function that will process either the onTrue or the onFalse function depending upon the result of the condition predicate.

public

F noop()

This method doing nothing and returns undefined.

public

F nothing(): Undefined

A function that always returns undefined.

public

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.

public

Autocurry for 2 arguments

Wraps a one-parameter function, new function returns true if passed parameter is undefined, otherwise returns result of calling fn

public

F tap(fn: Function, x: *): *

Autocurry for 2 arguments

Runs the given function with the supplied argument, then returns the argument.

public

F throttle(wait: number, fn: Function): *

Autocurry for 2 arguments

Creates a throttled function that only invokes fn at most once per every wait milliseconds.

public

F throttleEnd(wait: number, fn: Function): *

Autocurry for 2 arguments

Creates a throttled function that only invokes fn at most once per every wait milliseconds.

public

F tryCatch(tryer: Function, catcher: Function): Function

Autocurry for 2 arguments

Takes two functions, tryer and catcher.

public

F updatePropertyValue(propertyName: String, propertyValue: Any, obj: Object): Object

this function was deprecated. use propSet instead

Autocurry for 2 arguments

A function to change value by property name in object.

public

F when(pred: Function, onTrue: Function, x: *): *

Autocurry for 3 arguments

Tests the final argument by passing it to the given predicate function.

function/memoize

summary
public

F createCache(obj: Function): *

Creates a cache instance base on passed object.

public

Autocurry for 2 arguments

Memoize function with multiply arguments of any type, but it clears cache every time it reaches the limit.

public

F one(fn: Function, isEqual: Function): Function

Memoize function with multiply arguments of any type.

public

F with(createCache: Function, hasher: Function, function: Function): Function

Autocurry for 3 arguments

memoizeWith is a memoize function fabric.

is

summary
public

F array(test: *): boolean

Checks if test is array.

public

F arrayLike(test: *): boolean

Checks if test is arrayLike (has length and index properties).

public

F boolean(test: *): boolean

Checks if test is boolean.

public

F element(test: *): boolean

Checks if value is likely a DOM element.

public

F empty(test: *): boolean

Checks if test is empty.

public

F isEqual(test1: *, test2: *): Boolean

Autocurry for 2 arguments

Returns true if its arguments are equivalent, false otherwise.

public

F finite(test: *): boolean

Checks if test is finite.

public

F function(test: *): boolean

Checks if test is function.

public

F nil(test: *): boolean

Checks if test is nil (null or undefined).

public

F number(test: *): boolean

Checks if test is number.

public

F object(test: *): boolean

Checks if test is object.

public

F isPlainObject(test: *): boolean

Returns whether a value is a plain object (an object that is created using an object literal, Object.create(null) or similar).

public

F promise(test: *): boolean

Checks if test is Promise.

public

F shallowEqual(test1: *, test2: *): Boolean

Returns true if its arguments are equivalent is shallow equal terms, false otherwise.

public

F strictEqual(test1: *, test2: *): Boolean

Returns true if its arguments are equivalent is same value zero terms, false otherwise.

public

F string(test: *): boolean

Checks if test is string.

public

F undefined(test: *): boolean

Checks if test is undefined.

object

summary
public

F all(fn: Function, obj: Object): Boolean

Autocurry for 2 arguments

Tests whether every [key, value] pair in the object passes the test implemented by the provided function.

public

F any(fn: Function, obj: Object): Boolean

Autocurry for 2 arguments

Tests whether at least one [key, value] pair in the object passes the test implemented by the provided function.

public

F assoc(prop: String, val: *, obj: Object): Object

this function was deprecated. use object/propSet instead

Autocurry for 3 arguments

Makes a shallow clone of an object, setting or overriding the specified property with the given value.

public

F each(fn: Function, obj: Object): Object

Autocurry for 2 arguments

Iterate over an input object, calling a provided function fn for each key and value in the object.

public

F eqProps(prop: String, obj1: Object, obj2: Object): Boolean

Autocurry for 3 arguments

Reports whether two objects have the same value, in equal terms, for the specified property.

public

F filter(fn: Function, obj: Object): Object

Autocurry for 2 arguments

Takes a predicate and a object, and returns a new object containing only members which satisfy the given predicate.

public

Autocurry for 2 arguments

Returns first key in obj satisfied to fn, or undefined if there is no such keys

public

Creates a new object from a list key-value pairs.

public

F groupBy(fn: Function, obj: Object): Object

Autocurry for 2 arguments

Creates an object composed of keys generated from the results of running each element of object thru fn.

public

F has(prop: String, obj: Object): Boolean

Autocurry for 2 arguments

Returns whether or not an object has an own property with the specified name

public

F keyBy(fn: Function, obj: Object): Object

Autocurry for 2 arguments

Creates an object composed of keys generated from the results of running each element of object thru fn.

public

F keys(obj: Object): Array

Returns a list containing the names of all the enumerable own properties of the supplied object.

public

F map(fn: Function, obj: Object): Object

Autocurry for 2 arguments

Applies fn to each of the obj values, and returns new object.

public

F merge(sources: ...Object): Object

Autocurry for 2 arguments

Create a new object with the own properties of the first object merged with the own properties of the others objects.

public

F mergeDeep(sources: ...Object): Object

Autocurry for 2 arguments

Create a new object with the own properties of the first object deeply merged with the own properties of the other objects.

public

F mergeWith(fn: Function, sources: ...Object): Object

Autocurry for 3 arguments

Create a new object with the own properties of the first object merged with the own properties of the others objects.

public

F objOf(key: String, value: *): Object

Autocurry for 2 arguments

Creates an object containing a single key:value pair.

public

F omit(props: Array, obj: Object): Object

Autocurry for 2 arguments

Returns a partial copy of an object omitting the keys specified.

private

F _path(paths: *[], obj: {}): *

Autocurry for 2 arguments

null

public

F pathApply(paths: [String], fn: Function, obj: Object): *

Autocurry for 3 arguments

Returns the result of fn with given value at path.

public

F pathEq(paths: Array, value: *, obj: Object): Boolean

Autocurry for 3 arguments

Determines whether a nested path on an object has a specific value

public

F pathOr(paths: [String], value: *, obj: Object): *

Autocurry for 3 arguments

If the given, non-null object has a value at the given path, returns the value at that path.

public

F pathSet(paths: [String], value: *, obj: Object): Object

Autocurry for 3 arguments

Returns the result of "setting" the portion of the given data structure focused by the given paths to the given value.

public

F pathSetBy(paths: [String], fn: Function, obj: Object): Object

Autocurry for 3 arguments

Returns the result of "setting" the portion of the given data structure focused by the given paths to the result of fn call.

public

F pick(props: [String], obj: Object): Object

Autocurry for 2 arguments

Returns a partial copy of an object containing only the keys specified.

public

F pickBy(fn: Function, obj: Object): Object

Autocurry for 2 arguments

Returns a partial copy of an object containing only the keys with fn predicate returns true

public

F prop(prop: String, obj: Object): *

Autocurry for 2 arguments

Returns a function that when supplied an object returns the indicated property of that object, if it exists.

public

F propApply(propName: String, fn: Function, obj: Object): *

Autocurry for 3 arguments

Returns the result of fn with value of property in obj.

public

F propEq(propName: String, value: *, obj: *): Boolean

Autocurry for 3 arguments

Returns true if the specified object property is equal to the given value; false otherwise.

public

F propOr(propName: String, value: *, obj: Object): *

Autocurry for 3 arguments

If the given, non-null object has an own property with the specified name, returns the value of that property.

public

F propSet(prop: String, val: *, obj: Object): Object

Autocurry for 3 arguments

Makes a shallow clone of an object, setting or overriding the specified property with the given value.

public

F propSetBy(prop: String, fn: Function, obj: Object): Object

Autocurry for 3 arguments

Makes a shallow clone of an object, setting or overriding the specified property with the result of fn call.

public

F reduce(fn: Function, acc: *, obj: Object): *

Autocurry for 3 arguments

Returns a single item by iterating through the obj, successively calling the iterator function and passing it an accumulator value, current value and current key from the obj, and then passing the result to the next call.

public

F size(obj: Object): number

Gets the size of obj by returning the number of own enumerable properties.

public

F toPairs(obj: Object): Array

Converts an object into an array of key, value arrays.

public

F values(obj: Object): Array

Returns a list of all the enumerable own properties of the supplied object.

public

F where(spec: Object, obj: Object): Boolean

Autocurry for 2 arguments

Takes a spec object and a test object; returns true if the test satisfies the spec.

promise

summary
public

F rejectWith(func: Function, payload: *[]): Promise

Autocurry for 2 arguments

Returns a promise that rejects with a value returned by the supplied function when passed the supplied payload

public

F resolveWith(func: Function, payload: *[]): Promise

Autocurry for 2 arguments

Returns a promise that resolves with a value returned by the supplied function when passed the supplied payload

public

F tap(fn: Function, x: *): *

Autocurry for 2 arguments

Runs the given promise with the supplied argument.

string

summary
public

Converts string to camel case.

public

Returns the capitalized version of a string.

public

F endsWith(postfix: string, str: string): Boolean

Autocurry for 2 arguments

Checks if a string ends with the provided postfix

public

F escape(str: string): string

Converts the characters "&", "<", ">", '"', and "'" in string to their corresponding HTML entities.

public

Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in string.

public

Converts string to kebab case.

public

F repeat(n: Number, value: String): String

Autocurry for 2 arguments

Returns a string containing a repeated identical value.

public

F replace(pattern: RegExp | String, replacement: String, str: String): String

Autocurry for 3 arguments

Replace a substring or regex match in a string with a replacement.

public

Returns the snake case version of a string.

public

F split(delim: String | RegExp, str: String): Array

Autocurry for 2 arguments

Splits a string into an array of strings based on the given separator.

public

F startsWith(prefix: string, str: string): Boolean

Autocurry for 2 arguments

Checks if a string starts with the provided prefix

public

F template(replacements: Object, str: String): String

Autocurry for 2 arguments

Replaces string keywords with provided values

public

F test(pattern: RegExp, str: String): Boolean

Autocurry for 2 arguments

Determines whether a given string matches a given regular expression.

public

F toLower(str: String): String

Returns the lower case version of a string.

public

F toString(val: *): string

Converts value to a string.

public

F toUpper(str: String): String

Returns the upper case version of a string.

public

F trim(str: String): String

Removes leading and trailing whitespace from str.

public

Removes leading whitespace from str.

public

The inverse of escape; this method converts the HTML entities &amp;, &lt;, &gt;, &quot;, and &#39; in string to their corresponding characters.

public

Converts the first character of string to upper case and returns the new string.

public

F words(str: String): String[]

Splits string into an array of its words.