Acid

2.0.0

$

Acid Object accessible through $ default method is model.

$(args: ...any): any
Parameters
args (...any)
Returns
any: The return value of the superMethod. The default superMethod is model.
Example
$('modelName', {example: 1});
// => {example: 1}
Static Members
superMethod(callable)
info

keys

Get object's keys.

keys(object: any): Array
Parameters
object (any) Object to pull keys from.
Returns
Array: Array of keys.
Example
keys({a: 1, b: 2});
// => ['a', 'b']

is

Determines whether two values are the same value.

is(object: any, object: any): Boolean
Parameters
object (any) Value to compare to.
object (any) A value to compare.
Returns
Boolean: A Boolean indicating whether or not the two arguments are the same value.
Example
is('foo', 'foo');
// => true

assign

Copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.

assign(target: Object, sources: Object): Object
Parameters
target (Object) The target object.
sources (Object) The source object(s).
Returns
Object: Returns the target object.
Example
assign({b: 2}, {a: 1});
// => {b: 2, a: 1}

getOwnPropertyDescriptor

Returns a property descriptor for an own property (that is, one directly present on an object and not in the object's prototype chain) of a given object.

getOwnPropertyDescriptor(obj: Object, property: String): Object
Parameters
obj (Object) The target object.
property (String) The name of the property whose description is to be retrieved.
Returns
Object: A property descriptor of the given property if it exists on the object, undefined otherwise.
Example
getOwnPropertyDescriptor({ bar: 42 }, 'foo');
// => { configurable: true, enumerable: true, value: 42, writable: true }

defineProperty

Defines a new property directly on an object, or modifies an existing property on an object, and returns the object.

defineProperty(obj: Object, property: String, descriptor: Object): Object
Parameters
obj (Object) The object on which to define the property.
property (String) The name of the property whose description is to be retrieved.
descriptor (Object) The descriptor for the property being defined or modified.
Returns
Object: The object that was passed to the function.
Example
const obj = {};
defineProperty(obj, 'key', {
 enumerable: false,
 configurable: false,
 writable: false,
 value: 'static'
});

getOwnPropertyNames

Returns an array of all properties (enumerable or not) found directly upon a given object.

getOwnPropertyNames(obj: Object): Object
Parameters
obj (Object) The object whose enumerable and non-enumerable own properties are to be returned.
Returns
Object: An array of strings that correspond to the properties found directly upon the given object.
Example
getOwnPropertyNames({ 0: 'a', 1: 'b', 2: 'c' });
// => ['0', '1', '2']

objectSize

Returns the amount of keys on the object.

objectSize(target: any, obj: Object): number
Parameters
target (any)
obj (Object) The target object.
Returns
number: The amount of keys.
Example
objectSize({ 0: 'a', 1: 'b', 2: 'c' });
// => 3

toArray

Takes an array like object and creates a new Array from it.

toArray(arrayLike: any): any
Parameters
arrayLike (any) Array like object.
Returns
any: new array.
Example
toArray([1, 2, 3]);
// => [1, 2, 3]

apply

Calls a target function with arguments as specified.

apply(target: Function, thisArgument: any, argumentsList: Array): any
Parameters
target (Function) The target function to call.
thisArgument (any) Array like object.
argumentsList (Array) An array-like object specifying the arguments with which target should be called.
Returns
any: The result of calling the given target function with the specified this value and arguments.
Example
apply((a) => {return [this, a];}, 1, 2);
// => [1, 2]

eachArray

Iterates through the given array.

eachArray(callingArray: Array, iteratee: Function): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, calling array, and array length.
Returns
Object: The originally given array.
Example
eachArray([1, 2, 3], (item) => {
  console.log(item);
});
// => [1, 2, 3]

eachArrayRight

Iterates through the given array in reverse.

eachArrayRight(callingArray: Array, iteratee: Function): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, calling array, and array length.
Returns
Object: The originally given array.
Example
eachArrayRight([1, 2, 3], (item) => {
  console.log(item);
});
// => [3, 2, 1]

whileArray

Iterates through the given array while the iteratee returns true.

whileArray(callingArray: Array, iteratee: Function): boolean
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, key, calling array, and array length.
Returns
boolean: Returns the true if all values returned are true or false if one value returns false.
Example
whileArray([true, true, false], (item) => {
  console.log(item);
  return item;
});
//true
//true
// => false

filterArray

Iterates through the calling array and creates an array with all elements that pass the test implemented by the iteratee.

filterArray(callingArray: Array, iteratee: Function, results: Array): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, the newly created object, calling array, and array length.
results (Array = []) Array that will be used to assign results.
Returns
Object: An array with properties that passed the test.
Example
filterArray([false, true, true], (item) => {
  return item;
});
// => [true, true]

mapArray

Iterates through the calling array and creates an object with the results of the iteratee on every element in the calling array.

mapArray(callingArray: Array, iteratee: Function, results: Array): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, the newly created array, calling array, and array length.
results (Array = []) Array that will be used to assign results.
Returns
Object: An array of the same calling array's type.
Example
mapArray({a: 1, b: 2, c: 3}, (item) => {
  return item * 2;
});
// => {a: 2, b: 4, c: 6}

mapArrayRight

Iterates through the calling array and creates an object with the results of the iteratee on every element in the calling array in reverse.

mapArrayRight(callingArray: Array, iteratee: Function, results: Array): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, the newly created array, calling array, and array length.
results (Array = []) Array that will be used to assign results.
Returns
Object: An array of the same calling array's type.
Example
mapArrayRight({a: 1, b: 2, c: 3}, (item) => {
  return item * 2;
});
// => {a: 2, b: 4, c: 6}

compactMapArray

Iterates through the calling array and creates an array with the results, (excludes results which are null or undefined), of the iteratee on every element in the calling array.

compactMapArray(callingArray: Array, iteratee: Function, results: Array): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, the newly created array, calling array, and array length.
results (Array = []) Array that will be used to assign results.
Returns
Object: An array with mapped properties that are not null or undefined.
Example
compactMapArray([0, 2, 3], (item) => {
  return item * 2;
});
// => [4, 6]

mapWhile

Iterates through the given and creates an object with all elements that pass the test implemented by the iteratee.

mapWhile(callingArray: Array, iteratee: Function, results: Array): Array
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, the newly created array, calling array, and array length.
results (Array = []) Array that will be used to assign results.
Returns
Array: An array with properties that passed the test.
Example
mapWhile({a: false, b: true, c: true}, (item) => {
  return true;
});
// => {b: true, c: true}

isUndefined

Checks if the value is undefined.

isUndefined(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isUndefined(undefined);
// => true

isNull

Checks if the value is null.

isNull(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isNull(null);
// => true

hasValue

Checks if the value is not null or undefined.

hasValue(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
hasValue(1);
// => true

isDecimal

Checks if the value is a decimal.

isDecimal(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isDecimal(1.01);
// => true

isArray

Checks if the value is an array.

isArray(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isArray([]);
// => true

isString

Checks if the value is a string.

isString(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isString('Lucy');
// => true

isNumber

Checks if the value is a number.

isNumber(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isNumber(1);
// => true

isPlainObject

Checks if the value is a plain object.

isPlainObject(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isPlainObject({});
// => true

isFunction

Checks if the value is a plain object.

isFunction(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isFunction({});
// => true

has

Checks if the value includes something.

has(value: (Array | String), search: any): boolean
Parameters
value ((Array | String)) Object to be checked.
search (any) Object that is being searched for.
Returns
boolean: True or false.
Example
has('My name is Acidjs', 'Acidjs');
// => true

hasLength

Checks if the value has length greater than 0.

hasLength(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
hasLength([1]);
// => true

isEmpty

Checks if the value is empty.

isEmpty(obj: any, value: any): boolean
Parameters
obj (any)
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isEmpty([]);
// => true

isFileCSS

Checks if the string has a .css extension.

isFileCSS(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isFileCSS('test.css');
// => true

isFileCSS

Checks if the string has a .json extension.

isFileCSS(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isFileCSS('test.json');
// => true

isFileCSS

Checks if the string has a .js extension.

isFileCSS(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isFileCSS('test.js');
// => true

hasDot

Checks if the string has a '.'.

hasDot(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
hasDot('test.js');
// => true

getFileExtension

Return the file extension.

getFileExtension(string: any, value: any): string
Parameters
string (any)
value (any) Object to be checked.
Returns
string: Returns the extension.
Example
getFileExtension('test.js');
// => 'js'

isBoolean

Checks if the value is a Boolean.

isBoolean(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isBoolean(true);
// => true

isDate

Checks if the value is a Date.

isDate(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isDate(new Date());
// => true

isMap

Checks if the value is a Map.

isMap(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isMap(new Map());
// => true

isSet

Checks if the value is a Set.

isSet(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isSet(new Set());
// => true

isWeakMap

Checks if the value is a WeakMap.

isWeakMap(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isWeakMap(new WeakMap());
// => true

isArrayBuffer

Checks if the value is a ArrayBuffer.

isArrayBuffer(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isArrayBuffer(new ArrayBuffer());
// => true

isFloat32Array

Checks if the value is a Float32Array.

isFloat32Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isFloat32Array(new Float32Array());
// => true

isFloat64Array

Checks if the value is a Float64Array.

isFloat64Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isFloat64Array(new Float64Array());
// => true

isInt8Array

Checks if the value is a Int8Array.

isInt8Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isInt8Array(new Int8Array());
// => true

isInt16Array

Checks if the value is a Int16Array.

isInt16Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isInt16Array(new Int16Array());
// => true

isInt32Array

Checks if the value is a Int32Array.

isInt32Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isInt32Array(new Int32Array());
// => true

isArguments

Checks if the value is an Arguments object.

isArguments(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isArguments([]);
// => false

isUint8ClampedArray

Checks if the value is a Uint8ClampedArray.

isUint8ClampedArray(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isUint8ClampedArray(new Uint8ClampedArray());
// => true

isUint16Array

Checks if the value is a Uint16Array.

isUint16Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isUint16Array(new Uint16Array());
// => true

isUint32Array

Checks if the value is a Uint32Array.

isUint32Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isUint32Array(new Uint32Array());
// => true

isRegExp

Checks if the value is a RegExp.

isRegExp(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isRegExp(/test/);
// => true

isUint8Array

Checks if the value is a Uint8Array.

isUint8Array(value: any): boolean
Parameters
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isUint8Array(new Uint8Array());
// => true

asyncEach

Iterates through the given array of async function(s). Each async function is awaited as to ensure synchronous order and is given the supplied object.

asyncEach(callingArray: Array, object: any): Object
Parameters
callingArray (Array) Array of async functions that will be looped through. Functions are given the supplied object, index, the calling array, and the array length.
object (any) The first argument given to each function.
Returns
Object: The originally given array.
Example
asyncEach([async (item, index) =>{
 console.log(item, index);
}, async (item) =>{
 console.log(item, index);
}], {a:1});
// {a:1} 0
// {a:1} 1

ensureArray

Ensures the object is an array. If not wraps in array.

ensureArray(object: any): Array
Parameters
object (any) Data to be checked.
Returns
Array: Returns an array.
Example
ensureArray('Hello');
// => ['Hello']

ensureArray({a:1, b:2})
// => [{a:1, b:2}]

flatten

Flattens an array up to the provided level.

flatten(arrayArg: any, level: number, array: Array): Array
Parameters
arrayArg (any)
level (number = 1) Number which determines how deep the array nest can be.
array (Array) Array to flatten.
Returns
Array: Returns an array.
Example
flatten([1, [2, [3, [4]], 5]]);
 // => [1, 2, [3, [4]], 5]

flattenDeep

Flattens an array to a single level.

flattenDeep(array: Array): Array
Parameters
array (Array) Array to flatten.
Returns
Array: Returns a completely flattened array.
Example
flattenDeep([1, [2, [3, [4]], 5]]);
// => [1, 2, 3, 4, 5]

remove

Removes all occurrences of the passed in items from the array and returns the array. This mutates the given array. Clone the array if you desire to avoid mutation.

remove(array: Array, removeThese: ...(string | Array)): Array
Parameters
array (Array) Array to be mutated.
removeThese (...(string | Array)) Items to remove from the array.
Returns
Array: The array this method was called on.
Example
remove([1, 2, 3, 3, 4, 3, 5], 1);
// => [2, 3, 3, 4, 3, 5]

remove([3, 3, 4, 5], 3, 4);
// => [5]

removeBy

Removes items that pass the method's test. This mutates the given array. Clone the array if you desire to avoid mutation.

removeBy(array: Array, iteratee: any, method: Function): Array
Parameters
array (Array) Array to be mutated.
iteratee (any)
method (Function) Function used to check object. Return true to remove the value.
Returns
Array: The array this method was called on.
Example
removeBy([1, 2, 3, 3, 4, 3, 5], (item) => { return Boolean(item % 2);}));
// => [2, 4]

chunk

Chunks an array according to a user defined number.

chunk(array: Array, size: number): Array
Parameters
array (Array) Array to be chunked.
size (number = 1) Number which determines the size of each chunk.
Returns
Array: A chunked version of the source array.
Example
chunk([1,2,3], 1);
// => [[1],[2],[3]]

rest

Extracts all items in array except the first and last item.

rest(array: Array): Array
Parameters
array (Array) Array to be sliced.
Returns
Array: Returns the aggregated array.
Example
rest([1, 2, 3, 4, 5]);
// => [2, 3, 4, 5]

clear

Clears the values out of an array.

clear(array: Array): Array
Parameters
array (Array) Takes an array to be emptied.
Returns
Array: The originally given array.
Example
clear([1,'B', Cat]);
// => []

Get the item at the supplied index starting at the end of the array.

right(array: Array, amount: any): any
Parameters
array (Array) Array to be sliced.
amount (any)
Returns
any: Returns the object at the evaluated position.
Example
right([1, 2, 3, 4, 5] , 1);
// => 4

cloneArray

Clears the values out of an array.

cloneArray(array: Array): Array
Parameters
array (Array) Takes an array to be cloned.
Returns
Array: The originally given array.
Example
cloneArray([1,'B', Cat]);
// => [1, 'B', Cat]

add

Adds two numbers.

add(number: number, value: number): number
Parameters
number (number) First number.
value (number) Second number.
Returns
number: Returns the sum of the arguments.
Example
add(1, 1);
// => 2

minus

Subtracts two numbers.

minus(number: number, value: number): number
Parameters
number (number) First number.
value (number) Second number.
Returns
number: Returns the difference of the arguments.
Example
minus(1, 1);
// => 0

divide

Divides two numbers.

divide(number: number, value: number): number
Parameters
number (number) First number.
value (number) Second number.
Returns
number: Returns the quotient of the arguments.
Example
divide(10, 5);
// => 2

multiply

Multiplies two numbers.

multiply(number: number, value: number): number
Parameters
number (number) First number.
value (number) Second number.
Returns
number: Returns the product of the arguments.
Example
multiply(10, 5);
// => 50

remainder

Extracts the remainder between two numbers.

remainder(number: number, value: number): number
Parameters
number (number) First number.
value (number) Second number.
Returns
number: Returns the remainder of the arguments.
Example
remainder(10, 6);
// => 4

increment

Increments a number.

increment(number: number): number
Parameters
number (number) First number.
Returns
number: Returns an incremented version of the number.
Example
increment(10);
// => 11

deduct

Decrements a number.

deduct(number: number): number
Parameters
number (number) First number.
Returns
number: Returns a decremented version of the number.
Example
deduct(10);
// => 9

randomArbitrary

Produces a random number between min (included) and max (excluded).

randomArbitrary(max: number, min: number): number
Parameters
max (number) Establishes highest possible value for the random number.
min (number = 0) Establishes lowest possible value for the random number.
Returns
number: Returns random integer between the max and min range.
Example
randomArbitrary(10);
// => 9.1

randomInt

Produces a random integer between min (included) and max (excluded).

randomInt(max: number, min: number): number
Parameters
max (number) Establishes highest possible value for the random number.
min (number = 0) Establishes lowest possible value for the random number.
Returns
number: Returns random integer between the max and min range.
Example
randomInt(10);
// => 9

sample

Produce a random sample from the list. Pass a number to return n random elements from the list. Otherwise a single random item will be returned.

sample(array: Array, amount: any): Array
Parameters
array (Array) Array to pull sample(s).
amount (any = 1)
Returns
Array: An array of randomly pulled samples.
Example
sample([1, 2, 3, 4] , 2);
// => [1, 3]

compact

Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are falsey.

compact(array: Array): Array
Parameters
array (Array) Array to be compacted.
Returns
Array: The new array of filtered values.
Example
compact([1,'B', Cat, false, null, 0 , '', undefined, NaN]);
// => [1, 'B', Cat]

shuffle

Shuffle an array and return a new array.

shuffle(array: Array, amount: any): Array
Parameters
array (Array) Array to be shuffled.
amount (any = array.length)
Returns
Array: An array with the shuffled results.
Example
shuffle([1, 2, 3, 4]);
// => [3, 4, 2, 1]

initial

Takes all but the last item in the array.

initial(array: Array): Array
Parameters
array (Array) Array to have items extracted from.
Returns
Array: Returns a completely flattened array.
Example
initial([1, 2, 3, 4, 5]);
// => [1, 2, 3, 4]

smallest

Plucks the smallest value from an array.

smallest(array: Array): number
Parameters
array (Array) Array from which smallest number is taken.
Returns
number: The smallest number.
Example
smallest([1,2,3]);
// => 1

range

range
Parameters
start (Number) Value which determines the start of the range.
end (Number) Value which determines the end of the range.
increment (Number = 1) Value which determines the rate of incrementation.
Returns
Array:
Example
range([1,'B', Cat, false, null, 0 , '', undefined, NaN]);
// => [1, 'B', Cat]

rangeRight

rangeRight
Parameters
start (Number) Value which determines the start of the range.
end (Number) Value which determines the end of the range.
increment (Number = 1) Value which determines the rate of incrementation.
Returns
Array:
Example
rangeRight([1,'B', Cat, false, null, 0 , '', undefined, NaN]);
// => [1, 'B', Cat]

intersect

Returns an new array that is the set intersection of the array and the input array(s).

intersect(array: Array, arrays: ...Array): Array
Parameters
array (Array) Array to compare other arrays to.
arrays (...Array) A variable number of arrays.
Returns
Array: The new array of unique values shared by all of the arrays.
Example
intersect([1, 2, 3], [2, 3, 4]);
// => [2, 3]

intersect([1, 2, 3], [101, 2, 50, 1], [2, 1]);
// => [1, 2]

sortAlphabetical

Perform alphabetical sort on a collection with the provided key name. Mutates the array.

sortAlphabetical(collection: any, key: any, array: Array): Array
Parameters
collection (any)
key (any)
array (Array) Array to be sorted.
Returns
Array: The sorted array.
Example
sortAlphabetical([1,2,3]);
// => 1

difference

Checks for differences between arrays, then creates an array based on those differences.

difference(array: Array, compare: Array): Array
Parameters
array (Array) Source array.
compare (Array) Array source array is compared against.
Returns
Array: An array which contains the differences between the source and compare array.
Example
compact([1, 2, 3], [1, 2]);
// => [3]

drop

Removes all items from an array after a specified index.

drop(array: Array, amount: number, upTo: number): Array
Parameters
array (Array) Source array.
amount (number) Amount of items to drop from the array.
upTo (number = array.length) Index to stop at.
Returns
Array: An array with all values removed after a user defined index.
Example
drop([1, 2, 3], 1);
// => [2, 3]

dropRight

Removes all items from an array before a specified index.

dropRight(array: Array, amount: number, upTo: number): Array
Parameters
array (Array) Source array.
amount (number) Amount of items to drop from the array.
upTo (number = array.length) Index to stop at.
Returns
Array: An array with all values removed before a user defined index.
Example
dropRight([1, 2, 3], 1);
// => [1, 2]

isMatchArray

Performs a shallow strict comparison between two objects.

isMatchArray(source: Array, compareArray: Array): boolean
Parameters
source (Array) Source object.
compareArray (Array) Object to compare to source.
Returns
boolean: Returns the true or false.
Example
isMatchArray([1, 2, 3], [1, 2, 3]);
// => true

sortedIndex

Uses a binary search to determine the index at which the value should be inserted into the list in order to maintain the list's sorted order.

sortedIndex(array: Array, n: any): Array
Parameters
array (Array) Array to be sorted.
n (any)
Returns
Array: The sorted array.
Example
sortedIndex([1,2,3]);
// => 1

largest

Plucks the largest value from an array.

largest(array: Array): number
Parameters
array (Array) Array from which largest number is taken.
Returns
number: The largest number.
Example
largest([1,2,3]);
// => 3

sum

Reduces the values in an array into a single number.

sum(array: Array): number
Parameters
array (Array) Array to be reduced.
Returns
number: Returns a single value.
Example
sum([1, 2, 3, 4]);
// => 10

eachAsync

Asynchronously Iterates through the given array. Each async function is awaited as to ensure synchronous order.

eachAsync(callingArray: Array, iteratee: Function): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, calling array, and array length.
Returns
Object: The originally given array.
Example
eachAsync([3,4], async (item, index) =>{
 console.log(item, index);
});
// 3 0
// 4 1

eachAsyncRight

Asynchronously Iterates through the given array in reverse. Each async function is awaited as to ensure synchronous order.

eachAsyncRight(callingArray: Array, iteratee: Function): Object
Parameters
callingArray (Array) Array that will be looped through.
iteratee (Function) Transformation function which is passed item, index, calling array, and array length.
Returns
Object: The originally given array.
Example
eachAsyncRight([3,4], async (item, index) =>{
 console.log(item, index);
});
// 4 1
// 3 0

last

Extracts item(s) from an array starting from the last item in the array.

last(array: Array, indexFrom: number): Array
Parameters
array (Array) Array to have items extracted from.
indexFrom (number = 0) Value which determines how many items are extracted from the array.
Returns
Array: Items from the array.
Example
last([1, 2, 3, 4, 5] , 2);
// => [5, 4]

last([1, 2, 3, 4, 5]);
// => 5

take

Returns a shallow copy of the array up to an amount.

take(array: Array, amount: any): Array
Parameters
array (Array) The array to be evaluated.
amount (any = 1)
Returns
Array: The aggregated array.
Example
take([1,2,3], 2);
// => [1, 2]

takeRight

Returns a shallow copy of the array up to an amount starting from the right.

takeRight(array: Array, amount: any): Array
Parameters
array (Array) The array to be evaluated.
amount (any = 1)
Returns
Array: The aggregated array.
Example
takeRight([1,2,3], 2);
// => [3, 2]

mapAsync

Asynchronously Iterates through the calling array and creates an object with the results of the iteratee on every element in the calling array.

mapAsync(array: any, iteratee: Function, callingArray: Array, results: Array): Object
Parameters
array (any)
iteratee (Function) Transformation function which is passed item, index, the newly created array, calling array, and array length.
callingArray (Array) Array that will be looped through.
results (Array = []) Array that will be used to assign results.
Returns
Object: An array of the same calling array's type.
Example
mapAsync({a: 1, b: 2, c: 3}, (item) => {
  return item * 2;
});
// => {a: 2, b: 4, c: 6}

unique

Filters the array down to unique elements.

unique(array: Array, isSorted: any): Array
Parameters
array (Array) The array to be filtered.
isSorted (any)
Returns
Array: The filtered array.
Example
unique([1, 2, 2, 4]);
// => [1, 2, 4]

union

Computes the union of the passed-in arrays: the list of unique items, in order, that are present in one or more of the arrays.

union(arrays: ...Array): Array
Parameters
arrays (...Array) The arrays to be evaluated.
Returns
Array: The aggregated array.
Example
union([1,2,4], [1,2,3]);
// => [1, 2]

compactMapAsync

Asynchronously performs a function on the items within an array.

compactMapAsync(array: Array, iteratee: Function): Array
Parameters
array (Array) Array to be compacted.
iteratee (Function) Iteratee to be performed on array.
Returns
Array: Array values after being put through an iterator.
Example
compactMapAsync([1, 2, 3, false], async () => {return item});
// => [1, 2, 3]

numSort

Sorts an array in place using a numerical comparison algorithm from lowest to highest.

numSort(numberList: Array): Array
Parameters
numberList (Array) Array of numbers.
Returns
Array: The array this method was called on.
Example
numSort([10, 0, 2, 1]);
// => [0, 1, 2, 10]

arrayToObject

Takes all but the last item in the array.

arrayToObject(values: any, properties: Array, array: Array): Array
Parameters
values (any)
properties (Array) Array to have items extracted from.
array (Array) Array to have items extracted from.
Returns
Array: Returns a completely flattened array.
Example
arrayToObject([1, 2, 3], ['i', 'love', 'lucy']);
// => {i:1, love:2, lucy: 3}

without

Returns a copy of the array with all instances of the values removed.

without(array: Array, removeThese: Array): Array
Parameters
array (Array) The array to be filtered.
removeThese (Array) Items to be removed.
Returns
Array: The filtered array.
Example
without([1, 2, 2, 4], 4);
// => [1, 2, 2]

findItem

Finds an object in a collection by the given id and property name.

findItem(collection: any, id: (number | string), propertyName: string, array: Array): Object
Parameters
collection (any)
id ((number | string)) The value to look for.
propertyName (string = 'id') The name of the property to compare.
array (Array) Collection to be checked for an item.
Returns
Object: The found object.
Example
findItem([{id: 1}, {id: 2}], 1);
// => {id: 1}

findIndex

Finds an object in a collection by the given id and property name and returns the array index of the object.

findIndex(collection: any, id: (number | string), propertyName: string, array: Array): number
Parameters
collection (any)
id ((number | string)) The value to look for.
propertyName (string = 'id') The name of the property to compare.
array (Array) Collection to be checked for an item.
Returns
number: The index of the object.
Example
findIndex([{id: 1}, {id: 2}], 1);
// => 0

partition

Split array into two arrays: one whose elements all satisfy predicate and one whose elements all do not satisfy predicate.

partition(array: Array, funct: Function): Array
Parameters
array (Array) Takes an array to split.
funct (Function) Function run on each item in array.
Returns
Array: One array split into two arrays.
Example
partition([
 {user: 'barney', age: 36, active: false},
 {user: 'fred', age: 40, active: true},
 {user: 'pebbles', age: 1,  active: false}
], (item) => { return item.active; });
// => [['fred'], ['barney', 'pebbles']]

xor

Creates an array that is the symmetric difference of the provided arrays.

xor(arrays: any, array: Array, removeThese: Array): Array
Parameters
arrays (any)
array (Array) The array to be filtered.
removeThese (Array) Items to be removed.
Returns
Array: The filtered array.
Example
xor([2, 1], [2, 3]);
// => [1, 3]

zip

Merges together the values of each of the arrays with the values at the corresponding position.

zip(args: ...any, properties: Array): Array
Parameters
args (...any)
properties (Array) The arrays to process.
Returns
Array: Returns the new array of regrouped elements.
Example
zip(['a', 'b'], [1, 2], [true, false]);
// => [['a', 1, true], ['b', 2, false]]

unZip

Takes an array of grouped elements and creates an array regrouping the elements to their pre-zip array configuration.

unZip(array: any, properties: Array): Array
Parameters
array (any)
properties (Array) The array of grouped elements to process.
Returns
Array: Returns the new array of regrouped elements.
Example
unZip([['a', 1, true], ['b', 2, false]]);
// => [['a', 'b'], [1, 2], [true, false]]

first

Takes the first or multiple items from an array.

first(array: Array, upTo: number): Array
Parameters
array (Array) Array to extract from.
upTo (number) Number which determines how many items after the first item are extracted from the array.
Returns
Array: Returns an array.
Example
first([1, 2, 3]);
// => [1]

first([1, 2, 3], 2);
// => [1, 2, 3]

rNumSort

Sorts an array in place using a reverse numerical comparison algorithm from highest to lowest.

rNumSort(numberList: Array): Array
Parameters
numberList (Array) Array of numbers.
Returns
Array: The array this method was called on.
Example
rNumSort([10, 0, 2, 1]);
// => [10, 2, 1, 0]

times

Iterates based on a start index and an end index. The loop ends when the start index is equal to the end index.

times(startIndex: number, endIndex: number, iteratee: Function): undefined
Parameters
startIndex (number) The number to start loop from.
endIndex (number) The number to stop at the loop.
iteratee (Function) Transformation function which is passed position, start, and end.
Returns
undefined: Nothing.
Example
times(0, 3, (item) => {
  console.log(item);
});
//Will log
// 0
// 1
// 2
// => undefined

timesMap

Iterates based on a start index and end index. Creates an array with the results of the iteratee on every element in the calling array. The loop ends when the start index is equal to the end index.

timesMap(startIndex: number, endIndex: number, iteratee: Function, results: Array): Object
Parameters
startIndex (number) The number to start loop from.
endIndex (number) The number to stop at the loop.
iteratee (Function) Transformation function which is passed position, start, and end.
results (Array = []) Array that will be used to assign results.
Returns
Object: An array with iteratee's returned values.
Example
timesMap(0, 3, (item) => {
  console.log(item);
});
// => [0, 1, 2]

isAgent

Checks to see of the browser agent has a string.

isAgent(value: string): boolean
Parameters
value (string) The string to search for.
Returns
boolean: Returns true or false.
Example
isAgent('mobile');
// => false

eventAdd

Attaches an event listener to a node.

eventAdd(node: Node, args: ...any, type: string, listener: (Object | Function), options: Object): Node
Parameters
node (Node) Given node.
args (...any)
type (string) A string representing the event type.
listener ((Object | Function)) The object which receives a notification when an event of the specified type occurs.
options (Object) An options object that specifies characteristics about the event listener.
Returns
Node: Returns given node.
Example
eventAdd(document.body, 'click', () => {console.log('CLICKED');});
// = > document.body

eventRemove

Attaches an event listener to a node.

eventRemove(node: Node, args: ...any, type: string, listener: (Object | Function), options: Object): undefined
Parameters
node (Node) Given node.
args (...any)
type (string) A string representing the event type.
listener ((Object | Function)) An object|function representing the listener.
options (Object) An options object that specifies characteristics about the event listener.
Returns
undefined: Undefined.
Example
eventRemove(document.body, () => {console.log('CLICKED');});
// = > Undefined

isEnter

Checks if the keycode of the event is strictly equal to 13.

isEnter(eventObject: Object): boolean
Parameters
eventObject (Object) Object to be checked.
Returns
boolean: Returns true if the keycode property of the object equals 13.
Example
isEnter('click');
// => false

eachObject

Iterates through the given object.

eachObject(thisObject: any, iteratee: Function, callingObject: (Object | Function)): (Object | Function)
Parameters
thisObject (any)
iteratee (Function) Transformation function which is passed item, key, calling object, key count, and array of keys.
callingObject ((Object | Function)) Object that will be looped through.
Returns
(Object | Function): The originally given object.
Example
eachObject({a: 1, b: 2, c: 3}, (item) => {
  console.log(item);
});
// => {a: 1, b: 2, c: 3}

whileObject

Iterates through the given object while the iteratee returns true.

whileObject(callingObject: Object, iteratee: Function, results: any): boolean
Parameters
callingObject (Object) Object that will be looped through.
iteratee (Function) Transformation function which is passed item, key, calling array, and array length.
results (any = {})
Returns
boolean: Returns the true if all values returned are true or false if one value returns false.
Example
whileObject({a: false, b: true, c: true}, (item) => {
  return item;
 });
// => false

filterObject

Iterates through the calling object and creates an object with all elements that pass the test implemented by the iteratee.

filterObject(object: any, iteratee: Function, results: (Object | Function), callingObject: (Object | Function)): (Object | Function)
Parameters
object (any)
iteratee (Function) Transformation function which is passed item, key, the newly created object, calling object, key count, and array of keys.
results ((Object | Function) = {}) Object that will be used to assign results.
callingObject ((Object | Function)) Object that will be looped through.
Returns
(Object | Function): An object with properties that passed the test.
Example
filterObject({a: false, b: true, c: true}, (item) => {
  return true;
});
// => {b: true, c: true}

mapObject

Iterates through the calling object and creates an object with the results of the iteratee on every element in the calling object.

mapObject(object: any, iteratee: Function, results: (Object | Function), callingObject: (Object | Function)): (Object | Function)
Parameters
object (any)
iteratee (Function) Transformation function which is passed item, key, the newly created object, calling object, key count, and array of keys.
results ((Object | Function) = {}) Object that will be used to assign results.
callingObject ((Object | Function)) Object that will be looped through.
Returns
(Object | Function): An object of the same calling object's type.
Example
mapObject({a: 1, b: 2, c: 3}, (item) => {
  return item * 2;
});
// => {a: 2, b: 4, c: 6}

compactMapObject

Iterates through the calling object and creates an object with the results, (excludes results which are null or undefined), of the iteratee on every element in the calling object.

compactMapObject(object: any, iteratee: Function, results: (Object | Function), callingObject: (Object | Function)): (Object | Function)
Parameters
object (any)
iteratee (Function) Transformation function which is passed item, key, the newly created object, calling object, key count, and array of keys.
results ((Object | Function) = {}) Object that will be used to assign results.
callingObject ((Object | Function)) Object that will be looped through.
Returns
(Object | Function): An object with mapped properties that are not null or undefined.
Example
compactMapObject({a: 0, b: 2, c: 3}, (item) => {
  return item * 2;
});
// => {b: 4, c: 6}

zipObject

Creates an object from two arrays, one of property identifiers and one of corresponding values.

zipObject(properties: Array, values: Array): Object
Parameters
properties (Array) The property identifiers.
values (Array) The property values.
Returns
Object: Returns the new object.
Example
zipObject(['a', 'b'], [1, 2]);
// => { 'a': 1, 'b': 2 }

unZipObject

Takes an array of grouped elements and creates an array regrouping the elements to their pre-zip object configuration.

unZipObject(object: Object): Array
Parameters
object (Object) The object to process.
Returns
Array: Returns two arrays one of keys and the other of values inside a single array.
Example
unZipObject({ 'a': 1, 'b': 2 });
// => [['a', 'b'], [1, 2]]

nodeAttribute

Assign attributes to a DOM node.

nodeAttribute(node: Node, object: (Object | Array)): (Object | Node)
Parameters
node (Node) The DOM node.
object ((Object | Array)) Object with key being the attribute name and the value being the attribute value. If an array is given it will get the values corresponding to the array items.
Returns
(Object | Node): If using an array this returns an object of attribute names as keys and their values as the property value. If using an object this will return the provided node.
Example
nodeAttribute(document.body, { 'data-example': 'test'});

promise

A wrapper around the promise constructor.

promise(callback: Function): Object
Parameters
callback (Function) Function to be called back.
Returns
Object: A constructor with a callback function.
Example
promise((a) => {});
// => promise((a) => {})

insertInRange

Inserts text into a string at a given position.

insertInRange(string: string, index: number, text: string): string
Parameters
string (string) String to insert the text into.
index (number) Point of insertion.
text (string) The string to be inserted.
Returns
string: The string with the text inserted at the given point.
Example
insertInRange('A from Lucy.', 1, ' tab');
// => 'A tab from Lucy.'

rightString

Plucks a letter using the index starting from the right.

rightString(string: string, index: number): string
Parameters
string (string) String to extract the letter from.
index (number = 1) The starting position.
Returns
string: A letter at the given index.
Example
rightString('rightString');
// => 'g'

rightString('rightString', 2);
// => 'n'

chunkString

Splits up a string into chunks.

chunkString(string: string, size: number?): Array
Parameters
string (string) String to chunked.
size (number?) The max string length per chunk.
Returns
Array: An array with strings that are <= size parameter.
Example
chunkString('chunk', 2);
// => ['ch', 'un', 'k']

initialString

Truncates everything before the index starting from the right.

initialString(string: string, index: number): string
Parameters
string (string) String to extract the initial letters from.
index (number = 1) Starting point from the right.
Returns
string: A string with the characters before the index starting from the right.
Example
initialString('initialString');
// => 'initialStrin'

initialString('initialString', 2);
// => 'initialStri'

restString

Truncates everything after a index.

restString(string: string, index: number): string
Parameters
string (string) String to extract the rest of the letters from.
index (number = 1) Starting point.
Returns
string: A string without the characters up-to to the index.
Example
restString('restString');
// => 'estString'

restString('restString', 2);
// => 'stString'

getByClass

Wrapper around getElementsByClassName.

getByClass()

getByTag

Wrapper around getElementsByTagName.

getByTag()

getById

Wrapper around getElementsByIdName.

getById()

querySelector

Wrapper around querySelector.

querySelector()

querySelectorAll

Wrapper around querySelectorAll.

querySelectorAll()

selector

Returns relevant DOM node.

selector(select: string): Node
Parameters
select (string) String to be evaluated.
Returns
Node: Returns a DOM node.
Example
selector('#node');
// => <div id="node"></div>

importjs

Asynchronously import a js file and append it to the head node.

importjs(url: any): Promise
Parameters
url (any)
Returns
Promise: Returns a promise.
Example
importjs('core.js');

isDocumentReady

Runs a function if the document has finished loading. If not, add an eventlistener.

isDocumentReady(callable: Function): (Boolean | Function)
Parameters
callable (Function) Function to be run.
Returns
(Boolean | Function): If the document is ready, returns a function. If not, return false.
Example
isDocumentReady(() => {return 1});
// => 1

updateDimensions

Save current document & window dimensions to the info property.

updateDimensions(): undefined
Returns
undefined: Returns undefined.
Example
updateDimensions();

ifInvoke

Checks if the given method is a function. If it is then it invokes it with the given arguments.

ifInvoke(callable: Function, args: ...Array): any
Parameters
callable (Function) The function to be invoked if possible.
args (...Array) Arguments to pass to the method.
Returns
any: Returns the method invoked or undefined.
Example
ifInvoke((...args) => { return args;}, 1, 2);
// => [1, 2]
ifInvoke(undefined, 1, 2);
// => undefined

batch

Batch processing using requestAnimationFrame.

batch(items: ...Function): undefined
Parameters
items (...Function) The functions to add to the current batch.
Returns
undefined: Returns undefined.
Example
batch(() => {});
// => undefined

jsonParse

Parses JSON string.

jsonParse(string: string): Object
Parameters
string (string) String to be parsed.
Returns
Object: Returns the parsed object.
Example
jsonParse('{}');
// => {}

stringify

Stringify an object into a JSON string.

stringify(object: Object): string
Parameters
object (Object) Object to Stringify.
Returns
string: Returns the object as a valid JSON string.
Example
stringify({});
// => '{}'

cnsl

Console.trace wrapper with theme support.

cnsl(value: Object, themeName: string): undefined
Parameters
value (Object) The value to be logged.
themeName (string) The theme to be used.
Returns
undefined: Returns undefined.
Example
cnsl('Lucy', 'notify');
// 'Lucy'

cnslTheme

Create color themes for cnsl method.

cnslTheme(themeName: string, color: string, background: string): undefined
Parameters
themeName (string) The name of the theme.
color (string) The text color.
background (string) The background color of the block.
Returns
undefined: Returns undefined.
Example
cnslTheme('BlackNWhite', '#fff', '#000');

isNodeList

Checks if the value is a NodeList.

isNodeList(collection: any, key: any, pureMode: any, value: any): boolean
Parameters
collection (any)
key (any)
pureMode (any = true)
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isNodeList(document.querySelectorAll('.test'));
// => true

sortNewest

Sorts an array in place using a key from newest to oldest.

sortNewest(collection: Array, key: string, pureMode: boolean): Array
Parameters
collection (Array) Collection to be sorted.
key (string) The property name to sort by based on it's value.
pureMode (boolean = true) Mutates the source array. If set to false creates a new array.
Returns
Array: The sorted array and or a clone of the array sorted.
Example
sortNewest([{id: 1}, {id: 0}], 'id');
// => [{id: 1}, {id: 0}]

isHTMLCollection

Checks if the value is a HTMLCollection.

isHTMLCollection(collection: any, key: any, pureMode: any, value: any): boolean
Parameters
collection (any)
key (any)
pureMode (any = true)
value (any) Object to be checked.
Returns
boolean: True or false.
Example
isHTMLCollection(document.getElementsByClassName('test'));
// => true

getNewest

Sorts an array in place using a key from newest to oldest and returns the latest. Does not mutate the array.

getNewest(collection: Array, key: string): Object
Parameters
collection (Array) Collection to be sorted.
key (string) The property name to sort by based on it's value.
Returns
Object: The newest object in the collection.
Example
getNewest([{id: 1}, {id: 0}], 'id');
// => {id: 1}

sortOldest

Sorts an array in place using a key from oldest to newest.

sortOldest(collection: Array, key: string, pureMode: boolean): Array
Parameters
collection (Array) Collection to be sorted.
key (string) The property name to sort by based on it's value.
pureMode (boolean = true) Mutates the source array. If set to false creates a new array.
Returns
Array: The sorted array and or a clone of the array sorted.
Example
sortOldest([{id: 1}, {id: 0}], 'id');
// => [{id: 0}, {id: 1}]

getOldest

Sorts an array in place using a key from oldest to newest and returns the oldest. Does not mutate the array.

getOldest(collection: Array, key: string): Object
Parameters
collection (Array) Collection to be sorted.
key (string) The property name to sort by based on it's value.
Returns
Object: The newest object in the collection.
Example
sortOldest([{id: 1}, {id: 0}], 'id');
// => {id: 0}

groupBy

Creates an object composed of keys generated from the results of running each element of collection thru iteratee. The order of grouped values is determined by the order they occur in collection. The corresponding value of each key is an array of elements responsible for generating the key.

groupBy(array: any, iteratee: Function, collection: Array): Object
Parameters
array (any)
iteratee (Function) The iteratee to transform keys.
collection (Array) Array of objects.
Returns
Object: Returns the composed aggregate object.
Example
groupBy([6.1, 4.2, 6.3], Math.floor);
// => { '4': [4.2], '6': [6.1, 6.3] }

countBy

Creates an object composed of keys generated from the results of running each element of collection through iteratee.

countBy(collection: Array, iteratee: Function): Object
Parameters
collection (Array) Array of objects.
iteratee (Function) The iteratee to transform keys.
Returns
Object: Returns the composed aggregate object.
Example
countBy([{a:1}, {a:3}], (item) => { return 'a';}));
// => {a: 2}

countKey

Count the amount of times a key is present in a colleciton.

countKey(array: any, property: Function, collection: Array): number
Parameters
array (any)
property (Function) The name of the key.
collection (Array) Array of objects.
Returns
number: The count.
Example
countKey([{a:1}, {a:3}], 'a');
// => 2

countWithoutKey

Count the amount of times a key is not present in a colleciton.

countWithoutKey(array: any, keyName: any, collection: Array, property: string): number
Parameters
array (any)
keyName (any)
collection (Array) Array of objects.
property (string) The name of the key.
Returns
number: The count.
Example
countWithoutKey([{a:1}, {a:3}], 'b');
// => 2

indexBy

Given a list, and an iteratee function that returns a key for each element in the list (or a property name), returns an object with an index of each item. Just like groupBy, but for when you know your keys are unique.

indexBy(array: any, key: any, collection: Array, iteratee: Function): Object
Parameters
array (any)
key (any)
collection (Array) Array of objects.
iteratee (Function) The iteratee to transform keys.
Returns
Object: Returns the composed aggregate object.
Example
indexBy([{name: 'Lucy', id: 0}, {name: 'Erick', id: 1}], Math.floor);
// => { "0": {name: 'Lucy', id: 0}, "1": {name: 'Erick', id: 1}}

pluck

Returns an array of the plucked values from the collection.

pluck(collection: Array, pluckThis: string): Array
Parameters
collection (Array) Array used to determine what values to be plucked.
pluckThis (string) Property name.
Returns
Array: An array of plucked values.
Example
pluck([{lucy: 'Ants moving around on the walls.'}, {lucy: 'In the sky with diamonds.'}], ['a','b']);
// => ['Ants moving around on the walls.', 'In the sky with diamonds.']

invoke

Invokes a function on the provided property name in each object in the collection.

invoke(collection: Array, property: any, args: any, methodName: string): Array
Parameters
collection (Array) Collection from which method will be taken.
property (any)
args (any) Values to be run through method.
methodName (string) Value used to pluck method from object.
Returns
Array: Returns the results of the invoked method.
Example
invoke([{lucy(item, index) { return [item, index];}}, {lucy(item, index) { return [item, index];}}], 'lucy', 'Arity LLC');
// => [['lucy', 'Arity LLC'], ['lucy', 'Arity LLC']]

invokeAsync

Asynchronously awaits & invokes a function on the provided property name in each object in the collection.

invokeAsync(collection: Array, property: any, args: any, methodName: string): Array
Parameters
collection (Array) Collection from which method will be taken.
property (any)
args (any) Values to be run through method.
methodName (string) Value used to pluck method from object.
Returns
Array: Returns the results of the invoked method.
Example
invokeAsync([{async lucy(item, index) { return [item, index];}}, {async lucy(item, index) { return [item, index];}}], 'lucy', 'Arity LLC');
// => [['lucy', 'Arity LLC'], ['lucy', 'Arity LLC']]

ary

Creates a function that invokes callable, with up to n arguments, ignoring any additional arguments.

ary(callable: Function, amount: number): Object
Parameters
callable (Function) The function to cap arguments for.
amount (number) The arity cap.
Returns
Object: Returns the new capped function.
Example
ary((...args) => { return args;}, 2)(1, 2, 3);
// => [1, 2]

curry

Creates a function that accepts arguments of method and either invokes method returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining method arguments, and so on. The arity of method may be specified if method length is not sufficient.

curry(callable: Function, arity: number): any
Parameters
callable (Function) The function to curry.
arity (number = callable.length) The arity of method.
Returns
any: Returns the new curried function.
Example
const curried = curry((a, b, c) => {
  return [a, b, c];
});
curried(1)(2)(3);
// => [1, 2, 3]

curryRight

Creates a function that accepts arguments of method and either invokes method returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining method arguments, and so on. The arity of method may be specified if method.length is not sufficient. The arguments are given in reverse order.

curryRight(callable: Function, arity: number): any
Parameters
callable (Function) The function to curry.
arity (number = callable.length) The arity of method.
Returns
any: Returns the new curried function.
Example
const curried = curryRight((a, b, c) => {
  return [a, b, c];
});
curried(1)(2)(3);
// => [1, 2, 3]

once

Creates a function that is restricted to execute method once. Repeat calls to the function will return the value of the first call. The method is executed with the this binding of the created function.

once(callable: Function): Function
Parameters
callable (Function) The function to be called.
Returns
Function: Returns the new pass-thru function.
Example
const onceOnly = once(() => { return 1;});
onceOnly();
// => 1
onceOnly();
// => 1

after

Creates a function that executes callable, only after being called n times.

after(callable: Function, amount: number): Function
Parameters
callable (Function) The function to be called.
amount (number) The number of calls until method is invoked.
Returns
Function: Returns the new pass-thru function.
Example
const onlyAfter = after(1, () => { return 1;});
onlyAfter();
// => undefined
onlyAfter();
// => 1

before

Creates a function that executes callable, only before n times.

before(callable: Function, amount: number): Function
Parameters
callable (Function) The function to be called.
amount (number) The number of calls before n.
Returns
Function: Returns the new pass-thru function.
Example
const onlyBefore = before(3, () => { return 1;});
onlyBefore(1);
// => 1
onlyBefore(2);
// => 2
onlyBefore(3);
// => 2

stubObject

This method returns a new empty object.

stubObject(): Object
Returns
Object: Returns the new empty object.
Example
stubObject();
// => {}

stubArray

This method returns a new empty array.

stubArray(): Array
Returns
Array: Returns the new empty array.
Example
stubArray();
// => []

stubString

This method returns a new empty string.

stubString(): string
Returns
string: Returns the new empty string.
Example
stubString();
// => ''

stubFalse

This method returns false.

stubFalse(): boolean
Returns
boolean: Returns false.
Example
stubFalse();
// => false

stubTrue

This method returns true.

stubTrue(): boolean
Returns
boolean: Returns true.
Example
stubTrue();
// => true

noop

This method returns undefined.

noop(): undefined
Returns
undefined: Returns undefined.
Example
noop();
// => undefined

eachWhile

Iterates through the given object while the iteratee returns true.

eachWhile(callingObject: (Object | Array | Function), iteratee: Function): boolean
Parameters
callingObject ((Object | Array | Function)) Object that will be looped through.
iteratee (Function) Transformation function which is passed item, key, calling array, and array length.
Returns
boolean: Returns the true if all values returned are true or false if one value returns false.
Example
eachWhile({a: false, b: true, c: true}, (item) => {
  return item;
 });
// => false

each

Iterates through the given object.

each(callingObject: (Array | Object | Function), iteratee: Function): (Array | Object | Function)
Parameters
callingObject ((Array | Object | Function)) Object that will be looped through.
iteratee (Function) Transformation function which is passed item, key, the newly created map object and arguments unique to mapArray or mapObject depending on the object type.
Returns
(Array | Object | Function): The originally given object.
Example
each([1, 2, 3], (item) => {
  console.log(item);
});
// => [1, 2, 3]
each({a: 1, b: 2, c: 3}, (item) => {
  console.log(item);
});
// => {a: 1, b: 2, c: 3}

filter

Iterates through the calling object and creates a new object of the same calling object's type with all elements that pass the test implemented by the iteratee.

filter(callingObject: (Array | Object | Function), iteratee: Function, results: (Object | Function)): (Array | Object | Function)
Parameters
callingObject ((Array | Object | Function)) Object that will be looped through.
iteratee (Function) Transformation function which is passed item, key, the newly created map object and arguments unique to mapArray or mapObject depending on the object type.
results ((Object | Function) = {}) Object that will be used to assign results.
Returns
(Array | Object | Function): A new object of the same calling object's type.
Example
filter([false, true, true], (item) => {
  return item;
});
// => [true, true]
filter({a: false, b: true, c: true}, (item) => {
  return true;
});
// => {b: true, c: true}

map

Iterates through the calling object and creates a new object based on the calling object's type with the results of the iteratee on every element in the calling object.

map(callingObject: (Array | Object | Function), iteratee: Function, results: (Object | Function)): (Array | Object | Function)
Parameters
callingObject ((Array | Object | Function)) Object that will be looped through.
iteratee (Function) Transformation function which is passed item, key, the newly created map object and arguments unique to mapArray or mapObject depending on the object type.
results ((Object | Function) = {}) Object that will be used to assign results.
Returns
(Array | Object | Function): A new object of the same calling object's type.
Example
map([1, 2, 3], (item) => {
  return item * 2;
});
// => [2, 4, 6]
map({a: 1, b: 2, c: 3}, (item) => {
  return item * 2;
});
// => {a: 2, b: 4, c: 6}

compactMap

Iterates through the calling object and creates a new object based on the calling object's type with the results, (excludes results which are null or undefined), of the iteratee on every element in the calling object.

compactMap(callingObject: (Array | Object | Function), iteratee: Function, results: (Object | Function)): (Array | Object | Function)
Parameters
callingObject ((Array | Object | Function)) Object that will be looped through.
iteratee (Function) Transformation function which is passed item, key, the newly created map object and arguments unique to mapArray or mapObject depending on the object type.
results ((Object | Function) = {}) Object that will be used to assign results.
Returns
(Array | Object | Function): A new object of the same calling object's type.
Example
compactMap([0, 2, 3], (item) => {
  return item * 2;
});
// => [4, 6]
compactMap({a: 0, b: 2, c: 3}, (item) => {
  return item * 2;
});
// => {b: 4, c: 6}

bindAll

Loops through an object or an array and binds the given object to all functions encountered.

bindAll(collection: (Object | Function | Array), bindThis: any): (Object | Function | Array)
Parameters
collection ((Object | Function | Array)) The functions to bind.
bindThis (any) Object to be bound to functions.
Returns
(Object | Function | Array): Returns the method invoked or undefined.
Example
const collection = bindAll([() => { return this;}], 'Lucy');
collection[0]();
// => 'Lucy'

const collection = bindAll({a() { return this;}}, 'Lucy');
collection.a();
// => 'Lucy'

negate

Creates a function that negates the result of the predicate callable.

negate(callable: Function): any
Parameters
callable (Function) The function to be invoked.
Returns
any: Returns the given methods result.
Example
negate(() => { return false;})();
// => true

every

Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate returns falsey. The predicate is invoked with three arguments: (value, index|key, collection).

every(collection: (Array | Object), predicate: Function): boolean
Parameters
collection ((Array | Object)) The collection to iterate over.
predicate (Function) The function invoked per iteration.
Returns
boolean: Returns true if all elements pass the predicate check, else false.
Example
every([[], true, 1, null, 'string'], Boolean);
// => false

over

Creates a function that invokes iteratees with the arguments it receives and returns their results.

over(iteratees: (Array | Object)): Function
Parameters
iteratees ((Array | Object)) The iteratees to invoke.
Returns
Function: Returns the new function.
Example
over([Math.max, Math.min])(1, 2, 3, 4);
// => [4, 1]

overEvery

Creates a function that checks if all of the predicates return truthy when invoked with the arguments it receives.

overEvery(predicates: (Array | Object)): Function
Parameters
predicates ((Array | Object)) The predicates to check.
Returns
Function: Returns the new function.
Example
const overEveryThing = overEvery([Boolean, isFinite]);
overEveryThing('1');
// => true
overEveryThing(null);
// => false

timer

Timer wrapper.

timer(callable: Function, time: number): Object
Parameters
callable (Function) The function to be invoked.
time (number) The time in milliseconds.
Returns
Object: Returns setTimeout ID.
Example
timer(() => {}, 100);
// => 0

interval

Interval wrapper.

interval(callable: Function, time: number): Object
Parameters
callable (Function) The function to be invoked.
time (number) The time in milliseconds.
Returns
Object: Returns setInterval ID.
Example
interval(() => {}, 100);
// => 0

clearIntervals

Clear all active intervals.

clearIntervals(callable: any, time: any): undefined
Parameters
callable (any)
time (any)
Returns
undefined: Returns undefined.
Example
clearIntervals();
// => undefined

debounce

Creates a debounced function that delays invoking callable until after wait milliseconds have elapsed since the last time the debounced function was invoked. The debounce function has a clear method to cancel the timer.

debounce(callable: Function, time: number): Function
Parameters
callable (Function) The function to be invoked.
time (number) The time in milliseconds.
Returns
Function: The debounced function.
Example
const debounced = debounce(() => { console.log('debounced'); }, 0);
// => debounced();

clearTimers

Clear all active timers.

clearTimers(callable: any, time: any): undefined
Parameters
callable (any)
time (any)
Returns
undefined: Returns undefined.
Example
clearTimers();
// => undefined

throttle

Creates a throttled function that only invokes callable at most once per every wait milliseconds. The throttle function has a clear method to cancel the timer.

throttle(callable: Function, time: number): Function
Parameters
callable (Function) The function to be invoked.
time (number) The time in milliseconds.
Returns
Function: The throttled function.
Example
const throttled = throttle(() => { console.log('debounced'); }, 0);
// => throttled();

chain

Creates a chainable set of functions.

chain(methods: (Array | Object)): any
Parameters
methods ((Array | Object)) The object to take methods from.
Returns
any: Returns a function which has value, methods, add, and done. When invoking the function the argument is saved as the value property for further chaining.
Example
const chained = chain({a(item) { return item;}});
chained('Acid').a();
// => 'Acid'

inSync

Invoke an array of functions.

inSync(collection: (Array | Object | Function), arg: any): undefined
Parameters
collection ((Array | Object | Function)) The functions to be invoked.
arg (any) The object passed as an argument to each method.
Returns
undefined: Returns undefined.
Example
inSync([() => {console.log(1);}, () => {console.log(2);}]);
// 1
// 2
// => undefined

inAsync

Invoke an array of functions asynchronously. Each function is awaited to ensure execution order.

inAsync(collection: (Array | Object | Function), arg: any): undefined
Parameters
collection ((Array | Object | Function)) The functions to be invoked.
arg (any) The object passed as an argument to each method.
Returns
undefined: Returns undefined.
Example
inAsync([async () => {console.log(1);}, async () => {console.log(2);}]);
// 1
// 2
// => undefined

nthArg

Creates a function that gets the argument at index n. If n is negative, the nth argument from the end is returned.

nthArg(index: number): Function
Parameters
index (number = 0) The index of the argument to return.
Returns
Function: Returns the new pass-thru function.
Example
nthArg(1)('a', 'b');
// => 'b'

reArg

Creates a function that invokes method with arguments arranged according to the specified indexes where the argument value at the first index is provided as the first argument, the argument value at the second index is provided as the second argument, and so on.

reArg(callable: Function, indexes: Array): Function
Parameters
callable (Function) The function to be invoked.
indexes (Array) The arranged argument indexes.
Returns
Function: Returns the new function.
Example
const reArged = reArg((a, b, c) => {
  return [a, b, c];
}, [1,2,0]);
reArged(1,2,3);
// => [2, 3, 1]

wrap

Creates a function that provides value to wrapper as its first argument. The wrapper function is given two arguments the value and the provided argument from the newly created function.

wrap(value: any, wrapper: Function): Function
Parameters
value (any) The value to wrap.
wrapper (Function) The wrapper function.
Returns
Function: The new function.
Example
const wrapped = wrap('Lucy', (firstName, lastName) => {console.log(`My name is ${firstName} ${lastName}.`);});
wrapped('Diamonds');
// => 'My name is Lucy Diamonds.'

isZero

Strictly checks if a number is zero.

isZero(item: number): boolean
Parameters
item (number) Number to be checked.
Returns
boolean: True or False.
Example
isZero(0);
// => true

isZero(1);
// => False

isNumberEqual

Strictly checks if a number equal to another number.

isNumberEqual(item: number, num: number): boolean
Parameters
item (number) Number to be checked against num.
num (number) Number to be checked against item.
Returns
boolean: True or False.
Example
isNumberEqual(0, 0);
// => true

isNumberEqual(0, 1);
// => False

isNumberInRange

Checks if a number is within a range.

isNumberInRange(num: number, start: number, end: number?): boolean
Parameters
num (number) Number to be checked.
start (number = 0) Beginning of range.
end (number? = start) End of range.
Returns
boolean: True or False.
Example
isNumberInRange(1, 0, 2);
// => True

isNumberInRange(1, -1, 0);
// => False

hasKeys

Checks to see if an object has all of the given property names.

hasKeys(object: Object, properties: Array): boolean
Parameters
object (Object) Object from which keys are extracted.
properties (Array) Array of object keys.
Returns
boolean: Returns true or false.
Example
hasKeys({Lucy: 'Ringo', John: 'Malkovich', Thor: 'Bobo'}, ['Lucy','Thor']);
// => true

hasKeys({Lucy: 'Ringo', John: 'Malkovich', Thor: 'Bobo'}, ['Lucy','Tom']);
// => false

hasAnyKeys

Checks to see if an object has any of the given property names.

hasAnyKeys(object: Object, properties: Array): boolean
Parameters
object (Object) Object from which keys are extracted.
properties (Array) Array of object keys.
Returns
boolean: Returns true or false.
Example
hasAnyKeys({Lucy: 'Ringo', John: 'Malkovich', Thor: 'Bobo'}, ['Lucy','Tom']);
// => true

hasAnyKeys({Lucy: 'Ringo', John: 'Malkovich', Thor: 'Bobo'}, ['Other','Tom']);
// => false

pick

Returns a clone of the source object with the plucked properties.

pick(source: Object, array: Array, newObject: Object): Object
Parameters
source (Object) Object to be cloned.
array (Array) Array used to determine what values to be plucked.
newObject (Object = {}) Object to be populated with plucked values.
Returns
Object: A new object with plucked properties.
Example
pick({a:1, b:2, c:3}, ['a','b']);
// => {a:1, b:2}

compactKeys

Extracts all key values from an object.

compactKeys(object: Object): Array
Parameters
object (Object) Object from which keys are extracted.
Returns
Array: Returns an array of key values.
Example
compactKeys({Lucy: 'Ringo', John: 'Malkovich', Thor: undefined, other: false, that: null});
// => ['Lucy', 'John', 'other']

isMatchObject

Performs a shallow strict comparison between two objects.

isMatchObject(source: Object, compareObject: Object): boolean
Parameters
source (Object) Source object.
compareObject (Object) Object to compare to source.
Returns
boolean: Returns the true or false.
Example
isMatchObject({a: [1,2,3]}, {a: [1,2,3]});
// => true

invert

Creates an inverted version of a given object by switching it's keys and values.

invert(thisObject: Object, invertedObject: Array): Object
Parameters
thisObject (Object) Object to be inverted.
invertedObject (Array = {}) Empty object to be populated with inverted values from thisObject.
Returns
Object: Returns object with keys and values switched.
Example
invert({a:1});
// => {1:a}

omit

Returns a clone of the given object without the given properties.

omit(originalObject: Object, array: Array): Object
Parameters
originalObject (Object) Object from which keys are extracted.
array (Array) Array of object keys.
Returns
Object: A new object with the removed.
Example
omit({a:1, b:2, ['a']});
// => {b:2}

upperCase

Converts a string and converts it entirely into uppercase.

upperCase(string: string): string
Parameters
string (string) String to be converted into upper case.
Returns
string: Converted string in upper case.
Example
upperCase('upper case');
// => 'UPPER CASE'

camelCase

Converts a string into Camel case format.

camelCase(string: string): string
Parameters
string (string) String to be converted into Camel case.
Returns
string: Converted string in Camel case.
Example
camelCase('camel case');
// => 'camelCase'

kebabCase

Converts a string into Kebab case format.

kebabCase(string: string): string
Parameters
string (string) String to be converted into Kebab case.
Returns
string: Converted string in Kebab case.
Example
kebabCase('kebab case');
// => 'kebab-case'

snakeCase

Converts a string into snake case format.

snakeCase(string: string): string
Parameters
string (string) String to be converted into snake case.
Returns
string: Converted string in Snake case.
Example
snakeCase('snake case');
// => 'snake_case'

replaceList

Replaces all occurrences of strings in an array with a value.

replaceList(string: string, array: Array, value: string): string
Parameters
string (string) String to be replaced.
array (Array) Strings to replace.
value (string) The match replacement.
Returns
string: The string with the replacement.
Example
replaceList('Her name was @user.', [[email protected]'], 'Lucy');
// => 'Her name was Lucy.'

rawURLDecode

Raw URL decoder.

rawURLDecode(string: string): string
Parameters
string (string) String to be replaced.
Returns
string: Converted string into the decoded URI Component .
Example
rawURLDecode('Lucy%20saw%20diamonds%20in%20the%20sky.');
// => 'Lucy saw diamonds in the sky.'

htmlEntities

Replaced sensitive characters with their matching html entity.

htmlEntities(string: string): string
Parameters
string (string) String to be replaced.
Returns
string: Replaced string.
Example
htmlEntities(`<script>console.log('Lucy & diamonds.')</script>`);
// => '&lt;script&gt;console.log('Lucy &amp; diamonds.')&lt;/script&gt;'

sanitize

Executes rawURLDecode followd by htmlEntities methods on a string.

sanitize(string: string): string
Parameters
string (string) String to be replaced.
Returns
string: Replaced string.
Example
sanitize(`<script>console.log('Lucy%20&%20diamonds.')</script>`);
// => '&lt;script&gt;console.log('Lucy &amp; diamonds.')&lt;/script&gt;'

tokenize

Break string by non-white space characters matches.

tokenize(string: string): Array
Parameters
string (string) String to be broken up.
Returns
Array: Array of words without white space characters.
Example
tokenize('I am Lucy!');
// => ["I", "am", "Lucy!"]

words

Break string into word matches.

words(string: string): Array
Parameters
string (string) String to be broken up.
Returns
Array: Array of words with word characters only.
Example
words('I am Lucy!');
// => ["I", "am", "Lucy"]

truncate

Truncates the string, accounting for word placement and character count.

truncate(string: string, maxLength: number): string
Parameters
string (string) String to be truncated.
maxLength (number) The desired max length of the string.
Returns
string: The mutated string.
Example
truncate('Where is Lucy?', 2);
// => 'Where'

truncateRight

Truncates the string, accounting for word placement and character count from the right.

truncateRight(string: string, maxLength: number): string
Parameters
string (string) String to be truncated.
maxLength (number) The desired max length of the string.
Returns
string: The mutated string.
Example
truncateRight('Where is Lucy?', 6);
// => 'Lucy?'

upperFirstLetter

Returns the first letter capitalized.

upperFirstLetter(string: string): string
Parameters
string (string) String to extract first letter from.
Returns
string: An upper case letter.
Example
upperFirstLetter('upper');
// => 'U'

upperFirst

Capitalizes the first letter.

upperFirst(string: string): string
Parameters
string (string) String to be mutated.
Returns
string: String with first letter capitalized.
Example
upperFirstLetter('upper');
// => 'Upper'

upperFirstAll

Capitalize all first letters.

upperFirstAll(string: string): string
Parameters
string (string) String to be mutated.
Returns
string: String with all first letters capitalized.
Example
upperFirstAll('Lucy is next up.');
// => 'Lucy Is Next Up.'

upperFirstOnly

Capitalize first letter and lower case the rest.

upperFirstOnly(string: string): string
Parameters
string (string) String to be mutated.
Returns
string: String with first letter capitalized.
Example
upperFirstOnly('LYSERGIC ACID DIETHYLAMIDE');
// => 'Lysergic acid diethylamide'

upperFirstOnlyAll

Capitalize all first letters and lower case the rest.

upperFirstOnlyAll(string: string): string
Parameters
string (string) String to be mutated.
Returns
string: String with all first letters capitalized.
Example
upperFirstOnlyAll('LYSERGIC ACID DIETHYLAMIDE');
// => 'Lysergic Acid Diethylamide'

assignDeep

Creates new object with deeply assigned values from another object/array.

assignDeep(object: Object, otherObject: Object, mergeArrays: boolean): Object
Parameters
object (Object) Object to be assigned new properties.
otherObject (Object) Object from which properties are extracted.
mergeArrays (boolean = true) Array from which items are assigned to the new object.
Returns
Object: Returns object with the newly assigned properties.
Example
assignDeep({a:1}, {b:2})
// => {a:1, b:2}

cacheNativeMethod

Caches a prototype method.

cacheNativeMethod(method: Function): Function
Parameters
method (Function) Prototype method.
Returns
Function: Cached method.
Example
cacheNativeMethod(Array.prototype.push);
// => function call() { [native code] }

ifNotEqual

Checks if a property on an object has a value. If not, it will assign a value.

ifNotEqual(rootObject: Object, property: string, equalThis: any): Object
Parameters
rootObject (Object) The object to check.
property (string) The property name which is to be checked.
equalThis (any) The reassignment value for the property being checked.
Returns
Object: Returns the provided rootObject.
Example
ifNotEqual({}, 'a', 1);
// => {a:1}

isEqual

Performs a deep comparison between two objects.

isEqual(object: any, compareObject: Object, source: Object): boolean
Parameters
object (any)
compareObject (Object) Object to compare to source.
source (Object) Source object.
Returns
boolean: Returns the true or false.
Example
isEqual({a: [1,2,3]}, {a: [1,2,3]});
// => true

propertyMatch

Using a deep comparison it checks if properties of two objects using an array are equal.

propertyMatch(object: any, compareObject: any, properties: any)
Parameters
object (any)
compareObject (any)
properties (any = keys(object))
Properties
null-null (Object) : takes an object.
null-null (Object) : takes an object.
null-null (Array) : takes in an array of properties.
Example
propertyMatch({
  a: 1,
  b: 2
}, {
  a: 1,
  b: 2
}, ['a', 'b']);
// => true

toPath

Breaks up string into object chain list.

toPath(string: string): Array
Parameters
string (string) String to be broken up.
Returns
Array: Array used to go through object chain.
Example
toPath('post.like[2]');
// => ['post', 'like', '2']

uid

Creates a numerical unique ID and recycles old ones. UID numerically ascends however freed UIDs are later reused.

uid(): number
Returns
number: Returns a unique id.
Example
uid();
// => 0

uid();
// => 1
Static Members
free(id)

get

Returns property on an object.

get(propertyString: string, objectChain: Object): Object
Parameters
propertyString (string) String used to retrieve properties.
objectChain (Object = $) Object which has a property retrieved from it.
Returns
Object: Returns property from the given object.
Example
get('post.like[2]', {
  post: {
    like: ['a','b','c']
  }
});
// => c

model

Set & Get a model.

model(modelName: string, object: any): any
Parameters
modelName (string) Name of the model.
object (any)
Properties
null-null (Object) : The model object.
Returns
any: Returns the associated model.
Example
model('test', {a: 1});
// => {a: 1}

model('test');
// => {a: 1}

toggle

Performs a toggle between 2 values using a deep or strict comparison.

toggle(value: (string | number | Object | Array), on: (string | number | Object | Array), off: (string | number | Object | Array)): (string | number | Object | Array)
Parameters
value ((string | number | Object | Array)) Strictly compared against the on argument.
on ((string | number | Object | Array)) Strictly compared against the value argument.
off ((string | number | Object | Array)) Value to be returned.
Returns
(string | number | Object | Array): The opposing value to the current.
Example
toggle(1, 2, 3);
// => 2

flow

Creates a function that returns the result of invoking the given functions, where each successive invocation is supplied the return value of the previous.

flow(collection: Array): Function
Parameters
collection (Array) Methods to invoke.
Returns
Function: Returns the new composite function.
Example
flow(increment, increment, deduct)(0);
// => 2

flowRight

This method is like flow except that it creates a function that invokes the given functions from right to left.

flowRight(collection: Array): Function
Parameters
collection (Array) Methods to invoke.
Returns
Function: Returns the new composite function.
Example
flowRight(increment, increment, deduct)(0);
// => 2

flowAsync

Creates a function that returns the result of invoking the given functions, where each successive invocation is supplied the return value of the previous.

flowAsync(collection: Array): Function
Parameters
collection (Array) Methods to invoke.
Returns
Function: Returns the new composite function.
Example
flowAsync(increment, increment, deduct)(0);
// => 2

flowRightAsync

This method is like flow except that it creates a function that invokes the given functions from right to left.

flowRightAsync(collection: Array): Function
Parameters
collection (Array) Methods to invoke.
Returns
Function: Returns the new composite function.
Example
flowRightAsync(increment, increment, deduct)(0);
// => 2