Returns true to indicate value passes evaluation, else returns false.
Finally returns true if predicate returns true for all elements in array,
else returns false.
Array to test.
Returns true if all elements in array are false, else returns false.
Array to test.
true if all elements in array are false, else returns false
Returns true if all elements in array are not null or undefined, else returns false.
Array to test.
true if all elements in array are not null or undefined, else returns false.
Returns true if all elements in array are true, else returns false.
Array to test.
true if all elements in array are true, else returns false.
Finally returns true if predicate returns true for at least 1 element in array,
else returns false.
Returns true to indicate value passes evaluation, else returns false.
Finally returns true if predicate returns true for at least 1 element in array,
else returns false.
Array to test.
Returns true if at least 1 element in array is false, else returns false.
Array to test.
true if at least 1 element in array is false, else returns false.
Returns true if all elements in array are true, else returns false.
Array to test.
true if all elements in array are true, else returns false.
Returns true if at least 1 element in array is true, else returns false.
Array to test.
true if at least 1 element in array is true, else returns false.
Finally returns array if predicate returns true, else returns defaultArray (optional,
defaults to empty array).
Boolean function to determine which array to return.
The default array to return.
Finally returns array if predicate returns true, else returns defaultArray.
Finally returns array if it is valid via isArray, else returns defaultArray.
Default array to return.
Finally returns array if it is valid via isArray, else returns defaultArray.
Array to test.
Finally returns the element at index if found in array, else returns undefined.
Index of element in array to return.
Finally returns the element at index if found in array, else returns undefined.
Array to get an element from.
Returns undefined if array has no elements, else returns a random element from array.
Array to get an element from.
Returns undefined if array has no elements, else returns a random element from
array.
Returns the first non-null, non-undefined element in array, else returns undefined.
Array to use.
The first non-null, non-undefined element in array, else returns undefined.
Returns an array containing only truthy values from array.
Array to use.
Returns an array containing only truthy values from array.
Finally returns an array containing all elements in array1 and array2 (includes duplicates).
Array to add elements to.
Finally returns an array containing all elements in array1 and
array2 (includes duplicates).
Array to add elements from.
Returns the number of elements in array.
The array to count.
Returns the number of elements in array.
Finally returns true if array's count is equal to count, else returns false.
The expected count.
Finally returns true if array's count is equal to count, else returns false.
Returns true if array's count is greater than 0, else returns false.
Array to test.
true if array's count is greater than 0, else returns false.
Returns true if array's count is equal to 0, else returns false.
Array to test.
true if array's count is equal to 0, else returns false.
Finally returns all elements in array2 that are not present in array1 (i.e., returns the
difference of array2 - array1).
Array to subtract.
Finally returns all elements in array2 that are not present in array1
Array to subtract from.
Inverse of includes. I.e., returns true if array does not include all elements,
else returns false.
Array of elements to check are excluded.
true if array does not include all elements, else returns false.
Array to test.
Finally returns array filled with a filler value starting from FillOptions.start to
FillOptions.end.
Value to fill array with.
Finally returns array filled with a filler value starting from
FillOptions.start to FillOptions.end.
Finally returns array filled recursively where a total number subsequent elements are
provided by a transformer that receives the previous element.
Returns a new value for prev.
Number of elements to fill array with.
Finally returns array filled recursively with elements provided by transformer.
Finally returns array elements where predicate returns true.
Returns true to keep value, else returns false to omit value.
Finally returns array elements where predicate returns true.
Array to filter.
Returns a filtered & transformed array by sequentially applying filter,
map, and filter to each element in 1 iteration to improve performance rather than
manually chaining these operations (which would result in several iterations).
I.e., keeps array elements where FilterMapOptions.preFilter (optional, defaults to
return true) is true, then uses transformer to return new elements, and finally
keeps elements where FilterMapOptions.postFilter (optional, defaults to
return true) is true.
Note: Filters will affect the provided index for transformer, e.g., if 'a' is
preFiltered from ['a', 'b'] then transformer receives index 0 for b.
Applied after options.preFilter (if value is kept) and
before options.postFilter, returns a new value, see map.
Finally returns array after applying a pre-filter, transformation, & post-filter.
Inverse of filter, i.e., finally returns array with elements where
predicate returns false.
Returns false to keep value, else returns true to omit value.
Finally returns array with elements where predicate returns false.
Array to filter.
Combines filter & filterNot to finally return a 2D array where the first array contains the
kept elements whilst the second array contains the remaining elements (that are
usually omitted in filter).
Returns true to keep value, else returns false to omit value.
Finally returns an array containing 2 arrays of the form [...kept, ...omitted].
Array to filter.
Finally returns the element where predicate is true, else returns defaultValue.
Value to return when predicate returns false.
Returns true to indicate the value passes evaluation (i.e.,
matches the search), else returns false to indicate value fails evaluation.
Finally returns the element where predicate is true, else returns defaultValue.
Restricts a given value to be inclusively within the range of min to max.
Item key to group by.
Finally returns an object mapping keys to either a group of items (via itemTransformer) or an
aggregate value (via aggregateTransformer).
Returns the first element of array if found else returns undefined.
Array to use.
The first element of array if found else returns undefined.
Finally returns true if array includes all elements, else returns false.
The elements to check for.
Finally returns true if array includes all elements, else returns false.
Array to test.
Finally returns the index of element if found in array, else returns -1.
Element to search for.
Index of element if found in array, else returns -1.
Array to search in.
Returns array without the last element.
Array to use.
Returns array without the last element.
Finally returns elements present in both array1 and array2.
Second array to test.
Finally returns elements present in both array1 and array2.
Returns true if value is an array, else returns false.
Value to test.
true if value is an array, else returns false
Inverse of split, i.e., Finally returns a string containing elements from array delimited by
delimiter (optional, defaults to ,)
Finally returns a string elements from array that are delimited by delimiter.
Uses selector to generate a string key from array elements, then finally returns a
Record containing entries where each element becomes the value to the key it provided.
Elements that provide an invalid key (e.g., undefined) are omitted.
Returns a key for element that will form an entry in the returned object.
Finally returns a Record containing entries where each element becomes the value to
the key it provided.
Returns the last element of array if it exists else returns undefined.
Array to use.
The last element of array if it exists else returns undefined.
Finally returns array containing elements mapped using transformer to provide the new value.
Returns a new value.
Finally returns array containing elements mapped using transformer to provide the
new value.
Array to map.
Finally returns array with element prepended.
Element to prepend.
Array to prepend to.
Finally returns array with element appended.
Element to append.
Array to append to.
Returns a number array containing numbers generated from
RangeOptions.start (inclusive, defaults to 0) to end (both inclusive) where the
interval between numbers will be equal to RangeOptions.step (defaults to 1).
range has standard behaviour except in the special case where the only provided argument is
a negative end that is less than start, which conveniently allows decrementing from
start to end.
Examples:
Number to generate up to (inclusive).
An array containing numbers generated between start to end (both inclusive) where
all numbers are seperated by an inteveral equal to step.
Finally returns array reduced to a single value using initialValue as the
starting value and transformer to provide the next value.
Starting value (i.e., the first prevValue accepted by transformer).
Accepts prevValue and returns a new prevValue.
Finally returns array reduced to a single value.
The array with elements to reduce.
Returns array with all elements in reverse order.
Array to reverse.
Returns array with all elements in reverse order.
Finally returns an array containing elements after total elements.
Returns an unchanged array if total is negative.
number of elements to skip (optional, defaults to 0).
Finally returns an array containing elements after total elements.
Array with elements to skip.
Finally returns array containing the elements from indexes start to end.
Returns an unchanged array will be unchanged if start is negative or end is less than
start or end exceeds the last index.
Index to stop at (inclusive, defaults to last index).
Finally returns array containing the elements from indexes start to end.
Returns array without the first element.
Array to use.
array without the first element.
Finally returns array containing elements before total (inclusive, defaults to 0) elements.
Returns an empty array if total is negative.
number of elements to take (inclusive, defaults to 0).
Finally returns array containing elements before total elements.
Array to use.
A reversed alternative to take, i.e., finally returns an array containing a total number of
elements taken from the end of array.
Returns an empty array if total is negative.
Number of elements to take (inclusive, defaults to 0).
Finally returns an array containing a total number of elements taken from the
end of array.
Array to use.
Combines take & skip to finally return a 2D array where the first array contains the
taken elements (i.e., before and including the total'th element) whilst the
second array contains the remaining untaken elements (i.e., [[...taken], [...untaken]]).
Returns an empty 2D array (i.e., [[], []]) if total is negative.
The number elements to take (optional, defaults to 0).
Finally returns an array containing 2 arrays of the form [...taken, ...untaken], or
an empty 2D array if total is negative.
Array to use.
Finally returns an array set (i.e., array without duplicates) containing all elements from
array1 & array2.
First array to use.
Finally returns an array set containing all unique elements from array1 & array2.
second array to use.
Returns array without duplicate primitive elements (i.e., reference elements such as
arrays & object elements are not tested hence are considered unique).
Array to use.
Returns array without duplicate primitive elements
Returns true if value is a boolean, else returns false.
Value to test.
true if value is a boolean, else returns false.
Runs handler, which receives a contextual object it representing value, before returning value.
Useful for running statements before assigning the resulting object to a variable:
Returns value.
Sequentially applies functions in a mathematical right-to-left order with a
beginning value of initialValue to finally return the output of the first (i.e.,
left-most) function in functions.
Useful for composing a series of functions on an initial value where the output of a function is
passed as an argument to the next function until a final result is returned by the
final function (N.B., the first function in functions is the
final function since compose uses mathematical right-to-left composition):
Unary functions to compose (optional, defaults to []).
Finally returns the output of the first (i.e., left-most) function in functions.
The initial value that is passed to the first function in
functions (optional, defaults to undefined).
Always returns false regardless of passed arguments.
Useful for defaulting an anonymous function to false:
false regardless of passed arguments.
Finally returns onTrue's output if predicate returns true, else returns onFalse's output.
Useful when conditionally returning a new value based on a condition:
Returns a boolean based on value where true triggers onTrue &
false triggers onFalse, (optional, defaults to return false).
optional value (optional, defaults to return value).
Returns the new value if predicate returns true (optional, defaults to return undefined).
Returns the new value if predicate returns false (optional, defaults to return undefined).
tryer (optional, defaults to return value).
optional value (optional, defaults to return value).
Finally returns output of tryer if no errors are thrown, else returns the output of
defaulter.
The value to test via predicate.
Returns true if value is a function (via typeof), else return `false.
Value to check.
true if value is a function (via typeof), else return `false
Returns true if value is an instance of Promise, else returns false.
Value to check.
true if value is a Promise, else returns false.
Finally returns the inverted boolean returned by predicate.
Useful for inverting predicate functions:
Non-curried function that returns a boolean to
negate (optional, defaults to return true)
Finally returns the inverted boolean returned by predicate.
Always returns undefined regardless of passed arguments.
Useful for providing a function as a placeholder without side effects:
undefined regardless of passed arguments.
Returns a Promise that resolves to the time in milliseconds for testFunction to return.
function to test.
A Promise that resolves to the time in milliseconds for testFunction to return.
Identical to compose but reverses the order of functions, i.e., sequentially applies
functions in a computational left-to-right order with a beginning value of initialValue.
Unary functions to pipe (optional, defaults to []).
Finally returns the output of the first (i.e., right-most) function in functions.
The initial value that is passed to the first function in
functions (optional, defaults to undefined).
Convenient alternative to using tapLog with Promises. I.e., passes message &
resolved promise value to loggerFunction to allow logging before finally returning the
unchanged promise.
Useful for logging a Promise value before returning it unchanged for
further use with other promise functions (e.g., during composition):
Message passed to loggerFunction.
LoggerFunction to pass message and resolved promise to (optional,
defaults to console.debug, has no effect on the finally returned value).
Finally returns the unchanged promise.
The Promise to log.
Asynchronous alternative to tryOr. I.e., finally returns output of tryer if no errors are
thrown, else returns the output of defaulter.
Useful for trying potentially errorful asynchronous operations and returning the successful output or defaulting an errorful output to a specific value:
Asynchronous function (accepting value) that is tried to return a final value if
no errors occur.
See tryOr
Finally returns a Promise containing that resolves to the output of tryer if
no errors are thrown, else resolves to the output of defaulter.
See tryOr
Immediately runs functionToRun and returns its output.
Serves as a convenient alternative to using an IFFE (Immediately invoked function expression) whilst reducing the number of parantheses to achieve the same behaviour.
Useful for immediatley running a function:
Function to run (optional, defaults to return undefined).
Output from functionToRun.
Returns AllStringTypeExampleValues with the values of
all StringTypeExampleValues updated using valueMapper.
Useful for testing a function on all possible string type values based on StringTypeDetails.
Returns a new value for each StringTypeExampleValues.
AllStringTypeExampleValues with the values of all StringTypeExampleValues updated using valueMapper.
Finally returns testCases where TestCaseDetail.expectedResult in all entries are
updated using testFunction.
Each ArgSet in TestCaseDetail.argSets will be passed to successive calls of
testFunction to support curried functions:
Function to test via updating test cases.
TestCases to run.
Finally returns testCases where TestCaseDetail.expectedResult in all entries are
updated using testFunction.
Uses transformer to finally return a new value for value.
Returns a new value.
Finally returns a new value.
Value to test.
Passes message and args to a loggerFunction that is run before finally returning the
first argument in args.
Serves as a convenient and extended alternative to passing a logger function to tap to
log an argument for inspection before returning it for further usage.
Message passed to loggerFunction.
LoggerFunction to pass message and args to (optional, defaults to
console.debug, has no effect on the finally returned value).
Finally returns the first argument in args.
All arguments to log where the first argument is finally returned.
Always returns true regardless of passes arguments.
Useful for defaulting an anonymous function to false:
true regardless of passes arguments.
Finally returns value if predicate returns false, else throws error.
Useful for halting an invalid composition:
Returns true to throw error (optional, defaults to return true), or
returns false to return value.
Error to throw (optional, defaults to a generic error).
Finally returns value is predicate is false, else throws.
Value to test.
Finally returns output of tryer if no errors are thrown, else returns the output of defaulter.
Useful for trying potentially errorful operations and returning the successful output or defaulting an errorful output to a specific value:
Tries to return a new value based on
optional value (optional, defaults to return value).
Returns the default value if an error occurs in
tryer (optional, defaults to return value).
optional value (optional, defaults to return value).
Finally returns output of tryer if no errors are thrown, else returns the output of
defaulter.
The value to try a potentially errorful operation on.
Convenience function similar to strictEquals but throws an error if value1 is
strictly equal (via ===) to value2, else returns void.
First value to compare.
Optional message to include in thrown error.
Finally returns true if value1 is strictly equal (via ===) to value2,
else returns false.
Second value to compare.
Returns a string (via typeof) indicating the type of value.
The value to check.
String indicating the type of value.
Always returns the identityValue (i.e., the first argument).
Value to return.
Always returns the identityValue (i.e., the first argument).
Finally returns true if value is an instance (via instanceof) of expectedInstanceType.
The expected instance type.
true if values's string type is equal to expectedStringType
The value to check the instance type of.
Returns true if value is either null or undefined, else returns false.
Value to test.
true if value is either null or undefined, else returns false.
Finally returns true if both value1 & value2 are true, else returns false.
First boolean to compare.
Finally returns true if both value1 & value2 are true, else returns false.
Second boolean to compare.
Inverts (via !) boolean value, i.e., returns true if value is false,
else returns false.
boolean to invert.
Returns true if value is false, else returns false.
Finally returns true if either or both value1 & value2 are true, else returns false.
First boolean to compare.
Finally returns true if either or both value1 & value2 are true,
else returns false.
Second boolean to compare.
Returns the max number of calls for the call stack.
Max number of calls for the call stack.
Finally returns true if value1 is strictly equal (via ===) to value2,
else returns false.
First value to compare.
Finally returns true if value1 is strictly equal (via ===) to value2,
else returns false.
Second value to compare.
Finally returns true if value's string type (i.e., returned by typeof) is equal to
expectedStringType.
The expected string type.
Finally returns true if values's string type is equal to expectedStringType.
The value to check the stirng type of.
Finally returns value if predicate returns true, else returns defaultValue.
Boolean function to determine which value to return.
The default value to return.
Finally returns value if predicate returns true, else returns defaultValue.
Returns the sum of adding value2 to value1.
The first number to add to.
The sum of both numbers.
The second number to add.
Returns true if 1 or more values in values returns true for all predicate functions in predicates.
The predicate functions that values are checked against.
true if 1 or more values in values returns true for all predicate functions in predicates.
The values to check.
Restricts a given value to be inclusively within the range of min to max.
Minimum value of the range.
Maximum value of the range.
Finally returns a number inclusively within the range of min to max.
Returns value decremented by 1.
The number to decrement.
value decremented by 1.
number-specific (only accepts values of type number) alternative to
strictEquals (which compares values of type any). I.e., Finally returns true if
value1 is numberically equal to value2, else returns false.
First value to compare.
Finally returns true if value1 is numberically equal to value2,
else returns false.
Second value to compare.
Returns value incremented by 1.
The number to increment.
value incremented by 1.
Returns value as a valid hexadecimal color string where the hexadecimal value is within the
range of 000000 to FFFFFF. Values below this range return the bottom of the
range whilst values exceeding this range return the top of the range.
Integer to convert.
value as a valid hexadecimal color string
Returns true if value is even, else returns false.
The number to check.
true if value is even, else returns false.
Returns true if value is a float, else returns false.
The value to test.
true if value is a float, else returns false.
Returns true if value is an integer, else returns false.
The value to test.
true if value is an integer, else returns false.
Returns largest number in values.
value maxed by 1.
Similar to max but maps elements in values to values that are used to determine the largest number.
Function that returns a value to compare.
The largest number.
List of items to map before determining the max.
Returns the sum of numbers.
Numbers to sum.
Sum of numbers.
Finally returns value where missing keys will return defaultValue.
Useful to ensure an object always return a default value (rather than undefined) for a
key that it does not contain:
The default value to return when value does not contain a
key (optional, defaults to undefined).
value where missing keys will return defaultValue.
The object to apply a default value to (optional, defaults to {}).
Finally returns a string containing all values' keys delimited by delimiter.
String to delimit keys (optional, defaults to ,).
Finally returns a string containing all values' keys delimited by delimiter.
Object with keys to delimit.
Finally returns a string containing all objectValues' values delimited by delimiter.
String to delimit values (optional, defaults to ,).
Finally returns a string containing all objectValues' values delimited by delimiter.
Returns value's entries as a 2D array containing entry arrays where an entry array is a
2 value tuple containing an entry's key and value.
object to get entries from.
Returns value's entries as a 2D array containing entry arrays (i.e.,
[['key', 'value'], ...]).
Returns the number of entries in value.
object with entries to count.
number of entries in value.
Returns true if value has 1 or more entries, else returns false.
object with entries to count.
true if value has 1 or more entries, else returns false.
Inverse of entriesCountIsAny, i.e., returns true if value has 0 entries, else
returns false.
object with entries to count.
true if value has 0 entries, else returns false.
Finally returns value with entries kept when optional predicate returns true.
Returns true to keep an entry else the entry is omitted from the.
returned object (optional, defaults to keep entries).
omitted from the returned object..
Finally returns an object containing value's filtered entries.
The object with entries to filter.
Finally returns true if value's keys includes all elements, else returns false.
string array of elements representing keys to check for.
Finally returns true if value's keys includes all elements, else returns false.
object with entries to test.
Finally returns true if value's values includes all elements, else returns false.
string array of elements representing values to check for.
Finally returns true if value's values includes all elements,
else returns false.
object with entries to test.
Finally returns valueObject with all keys (optional, defaults to []) injected as
entries with a value of defaultValue (optional, defaults to undefined).
String array of keys to inject (optional, defaults to []).
The default value of injected entries (optional, defaults to undefined).
Finally returns valueObject with all keys injected as entries with a value of
defaultValue.
The object to inject keys into.
Finally returns valueObject with keys (optional, defaults to []) that were
missing injected as entries with a value of defaultValue (optional, defaults to undefined).
String array of keys to inject (optional, defaults to []).
The default value of injected entries (optional, defaults to undefined).
Finally returns valueObject with missing keys injected as entries with a value of
defaultValue.
The object to inject keys into.
Finally returns value with the keys and values of entries inverted.
The object with entries to invert (optional, defaults to {}).
Finally returns an object containing entries of both value1 & value2.
Returns true if value is an object, else returns false.
object to test.
true if value is an object, else returns false
Returns a string array of value's keys.
object with keys to use.
Returns a string array of value's keys
Finally returns objectValue with all entries mapped using optional MapEntriesOptions to
provide new keys and values.
Finally returns an object containing objectValue's mapped entries.
The object with entries to map.
Finally returns objectValue with the keys of all entries mapped using optional transformer.
Returns the next key (optional, defaults to return the original key).
Finally returns an object containing objectValue's mapped entries.
The object with entries keys to map.
Finally returns objectValue with the values of all entries mapped using optional transformer.
Returns the next value (optional, defaults to return the original value).
Finally returns an object containing objectValue's mapped entries.
The object with entries values to map.
Finally returns an object containing all elements in both value1 & value2 where entries with
identical keys will be entries from value2.
The first object to merge.
Finally returns an object containing entries of both value1 & value2.
The second object to merge.
Finally returns value if it is valid via isObject, else returns defaultValue.
The default value to return (optional,
defaults to Record<string, unknown>).
Finally returns value if it is valid via isObject, else returns defaultValue
Value to test.
Returns value as a string.
Object to convert to string.
Optional number of spaces to indent the object (defaults to 0, i.e., no spacing).
value as a string.
Finally returns value where entries with a key included in keys are omited.
string array of keys to omit.
Finally returns value where entries with a key included in keys are omited.
The object with keys to filter.
Inverse of omitKeys, i.e., finally returns value where entries have a key included in keys.
String array of keys to pick.
Finally returns an object containing value's entries with keys that are included in keys.
The object with keys to pick.
Finally returns the value at key in objectValue if found, else returns undefined.
Intended for curried usage hence pluckKey accepts a key to generate a
"plucking" function that will finally return the value of objectValue at key:
String to pluck.
Finally returns the value at key in objectValue.
The object with keys to pluck.
Applies pluckKey to an array of objects, i.e., returns the value at key for
all objects in values. Serves as a convenient alternative to mapping pluckKey over an
array of objects.
Similar to pluckKey, pluckKeys is intended for curried usage hence accepts a key to generate a
"plucking" function that will finally return the values at key in all objects in values:
String to pluck.
An array of values at key in all objects in values.
Array of objects with keys to pluck.
Finally returns objectValue's entries reduced to a single value using initial as the
starting value and transformer to provide the next value.
Nested objects can optionally be reduced if includeNested is true, else only the root object objectValue is
reduced.
The first value of prev passed to the transformer.
Returns the next value (optional, defaults to return the original value).
Optional (defaults to false) boolea, if true, nested objects are reduced using
transformer, else only the root object objectValue is reduced.
An object containing objectValue's mapped entries.
The object with entries to reduce.
Returns an array of value's values.
object with values.
Returns an array of value's values.
Convenience method for generating strings with conditional sub-strings. Appends delimited muxMap keys that
have a true value to verbatimStr.
Delimits appended strings (optional, defaults to ' ').
Finally returns a string containing the verbatimStr appended with the delimited keys of
entries in stringsToToggleMap that have a true value.
Returns an array of Promise<ResolvedPromise> when all promises have resolved to
either fulfilled or rejected.
Serves as a functional polyfilled alternative to Promise.allSettled hence is
useful regardless of older browsers/runtimes when running several Promises & operating on
their resolved data:
Promises to run.
An array of Promise<ResolvedPromise> when all promises have resolved to
either fulfilled or rejected.
Finally returns a filtered array of ResolvedPromise where
all ResolvedPromise.status are status.
Serves as a convenient alternative to collecting resolved Promises from allSettled with a
specific resolved status:
String to filter ResolvedPromises by (optional, defaults to fulfilled).
Finally returns a filtered array of ResolvedPromise where
all ResolvedPromise.status are status.
Promises to run.
Returns a Promise resolving to delayMs after waiting for delayMs milliseconds.
Useful for pausing asynchronous operations for a specific duration:
Number of milliseconds to delay (optional, defaults to 1000ms)
A Promise resolving to delayMs after waiting for delayMs milliseconds.
Concurrency-controlled alternative to Promise.all. I.e., finally returns a
Promise containing an array of Promise values by asynchronously running promises via
a Promise pool where concurrency is limited to poolSize, and
each pool iteration's results are reactable via onPoolComplete.
Useful when asynchronously running several Promises in parallel with controlled concurrency:
Number of promises to run per pool iteration (optional,
defaults to Infinity).
Called when results are collected from running a Promise pool (optional,
defaults to return undefined).
Finally returns a Promise containing an array of Promise values.
Promises to run.
Convenient alternative to Promise.all that runs all promises (calling onProgress when
each Promise resolves) before finally returning an array of Promises.
Useful when responding to the completion of each Promise:
Called for each resolved Promise.
Finally returns an array of Promise<ResolvedPromise> when all promises have
resolved to either fulfilled or rejected.
Promises to run.
Asynchronous alternative to filter, i.e., finally returns a Promise containing
array elements where predicate returns a Promise boolean resolve to true,
else elements are omitted.
Returns a Promise boolean trueto keepvalue, else returns falseto omitvalue`.
Finally returns a Promise resolving to array elements where predicate returned a
Promise resolving to true.
Array to filter.
Single-value alternative to promiseSequence. I.e., synchronously runs promises in
sequential order using initialValue as the starting value and transformer to provide a
new value based on the previous value (i.e., prevValue) for each Promise to
finally return a Promise containing the a single value.
Useful when synchronously running several Promises where subsequent Promises may depend on
the result of the previous Promise:
Starting value.
Accepts prevValue to return a new value.
Finally returns a Promise containing an array of Promise values.
Promises to run.
Sequential alternative to promiseAll. I.e., synchronously runs promises in
sequential order to return a Promise containing an array of values.
Useful when synchronously running several Promises in an ordered sequence:
Promises to run.
Returns a Promise containing an array of values
Returns a string representing the promise's statuswhere the string is either'fulfilled', 'rejected', or 'pending'`.
Promise to check.
A string representing the promise's status`.
Provides a basic method to convert testFunction into an altered function that returns
a Promise, which can finally be called to return testFunction's error or
result depending on resolution of its returned Promise.
Useful when updating legacy functions to use Promises:
The legacy non-Promise function that accepts a callback function (i.e.,
(error, result) => undefined).
convert to return a Promise.
testFunction altered to finally return its callback data via a Promise.
The arguments for the original testFunction.
Finally returns error as a rejected Promise if timeout is exceeded,
else returns promise's value.
Useful for running a Promise within a fixed duration:
const fetchUsers = () => {
// ...returns `Promise`.
};
const users;
const timeout = 2000;
try {
users = rejectAfter(timeout)(fetchUsers()); // Actual value if `timeout` isn't exceeded.
} catch (e) {
users = []; // Default value if `timeout` exceeded.
}
An Error to return if timeout is exceeded (optional, defaults to a
generic Error).
Finally returns error as a rejected Promise if timeout is exceeded,
else returns promise's value.
A promise to potentially reject.
Finally returns error as a rejected Promise if timeout is exceeded,
else returns an array of values for each Promise in promises.
Useful for running several Promises within a fixed duration:
An Error to return if timeout is exceeded (optional, defaults to
generic Error).
Finally returns error as a rejected Promise if timeout is exceeded,
else returns an array of values for each Promise in promises
Returns value in camelCase.
string to alter.
Returns value in camelCase.
Returns value in 'CONSTANT_CASE'.
Array to test.
value in 'CONSTANT_CASE'.
Finally returns true if 'value' starts with target, else returns false.
Target string to check for.
Finally returns true if 'value' starts with target, else returns false.
string to test.
Returns value as an integer if value contains a valid hexadecimal color string,
else throws TypeError.
Valid hexadecimal strings are 7 character strings beginning with #, followed by a
hexadecimal number within the range of 000000 to FFFFFF beginning with a # prefix that is
follwed by a 6 digit hexadecimal number, e.g., #FFFFFF).
string to convert.
value as an integer if value contains a valid hexadecimal color string.
Returns value in 'I C' (initials case).
string to alter.
value in 'I C' (initials case).
Accepts a valid hex color value & returns it's inverted valid hex color.
valid hex color string to convert to hex color.
value as valid hex color.
Returns true if value is a color hexadecimal color string (via hexColorToInteger) where
hexadecimal number is within the range of 000000 to FFFFFF.
Value to test.
true if value is a color hexadecimal color string.
Returns true if value is a string, else returns false.
Value to test.
true if value is a string, else returns false.
Returns text as an array of numbers where each number is the incrementing number representation of letter characters where space character is considered the 0, 'a' is 1, etc. until 'z' which is 26.
Returns a string containing letters from text.
Returns value in kebab-case.
string to alter.
value in kebab-case
Returns value in 'lower case'.
Value to alter.
value in 'lower case'.
Finally returns a string with all words (via toWords) in value mapped to new values via
transformer, and delimited by joinDelimiter.
Returns a new word.
string to delimit words (optional, defaults to ' ').
string with words to map.
Returns value in PascalCase.
String to alter.
value in PascalCase.
Provides basic pluralization by finally returning value if it does not need pluralization (i.e.,
if value is an empty string, or countis0or less, orvalueis in already in plural form according tooptions.pluralMap), else returns a pluralized form of value(i.e., suffixed with eitheroptions.pluralSuffix, or a suffix provided by options.pluralMapwhich takes priority overoptions.pluralSuffix`).
Integer indicating whether to pluralize (optional, defaults to 0, pluralizes if
count is 1 or greater, else returns unchanged value)
Finally returns a string containing value in its pluralized form.
Finally returns a string containing all words (via toWords) in value in their
pluralized form (via pluralize) & delimited by joinDelimiter (optional, defaults to ' ').
Object mapping words to their count where count is an integer indicating whether to pluralize the word
A string to delimit words in the returned string (optional,
defaults to '').
pluralizeWordsd form (takes priority over options.pluralSuffix).
Finally returns a string containing value with all words in their pluralized form.
Returns a valid hexadecimal color string from value where all
color chunks are randomly generated (unless ignored via optional IgnoredHexColors which will
have their color chunks equal to those in value).
A string containing a valid hexadecimal color string to randomize (optional,
defaults to #000000 which is also the default for a value with an
invalid hexadecimal color string).
An object indicating which color chunks of a
hexadecimal color string should not be randomised (optional, defaults to {}).
A string containing a valid hexadecimal color string where all color chunks are
randomized unless ignored via IgnoredHexColors.
Finally returns value repeated count times.
Positive integer indicating the number of times value is
repeated (defaults to 0 if negative).
Finally returns a string containing value repeated count times.
Finally returns value with all matching occurances of find replaced with replace.
string to replace.
string to replace find with.
Finally returns value with all matching occurances of find replaced with replace.
string to search & replace in.
Finally returns value with the first matching occurance of find replaced with replace.
string to replace.
string to replace find with.
Finally returns value with the first matching occurance of find replaced with
replace.
string to search & replace in.
Returns value in 'Sentence case'.
string to alter.
value in 'Sentence case'.
Returns value in snake_case.
string to alter.
value in snake_case.
Finally returns an array containing a total of limit strings from value that were
previously delimited by delimiter.
Finally returns an array containing a total of limit strings from value that were
previously delimited by delimiter.
Returns true if 'value' starts with target, else returns false.
string to search for.
true if 'value' starts with target, else returns false.
string to search in.
Returns the number of characters in value.
string to test.
number of characters in value
Finally returns true if values's total characters equals count, else returns false.
The expected count.
Finally returns true if values's total characters equals count,
else returns false.
string to test.
Returns true if values's total characters is greater than 0, else returns false.
string to test.
true if values's total characters is greater than 0, else returns false.
Returns true if values's total characters is 0, else returns false.
string to test.
true if values's total characters is 0, else returns false.
Finally returns true if the literal string values of value1 & value2 are equal, else
returns false.
First value to test.
Finally returns true if the literal string values of value1 & value2 are equal,
else returns false.
Second value to test.
Inverse of stringIncludes (i.e., finally returns true if value does not include all elements,
else returns false).
Elements to check for.
Finally returns true if value does not include all elements,
else returns false
string to test.
Returns the first character of value.
string to use.
The first character of value
Finally returns value if predicate returns true, else returns defaultValue.
Returns true to indicate value should finally be returned,
else returns false to indicate defaultValue should be returned.
Value to return if predicate returns false (optional, defaults to
empty string).
Finally returns value if predicate returns true, else returns defaultValue.
Finally returns true if value includes all elements, else returns false.
Elements to check for.
Finally returns true if value includes all elements, else returns false.
string to use.
Similar to stringIncludes but treats elements and value as lowercase. I.e.,
finally returns true if value includes all elements (where value and elements are
always treated as lowercase), else returns false.
Elements to check for.
finally returns true if value includes all elements, else returns false
string to use.
Finally returns value if it is valid via isString, else returns defaultValue.
Finally returns value if it is valid via isString, else returns defaultValue.
Value to test.
Convenience method similar to stringToObject but focuses on arrays, i.e., finally returns value as an
array if value is a valid JSON string, else returns defaultValue.
string to convert to an array (optional, defaults to '').
array to return if value is not a valid JSON string (optional, defaults to []).
value as an array.
Returns value as an array of character codes.
string to convert to an array (optional, defaults to '').
value as an array of character codes.
Returns value as a positive hash number.
Useful for converting strings to pseudo-unique IDs that attempt to be unique to the string but there is a possibility of an ID being shared by multiple strings.
string to convert to hash.
value as a positive hash number.
Returns value as a string hexadecimal representation of character codes.
string to convert to hex.
value as a string hexadecimal representation of character codes.
Returns value as a valid hex color (i.e., a positive 6 digit hexadecimal prepended by '#' where any letters are uppercase).
Useful for converting strings to pseudo-unique IDs that attempt to be unique to the string but there is a possibility of an ID being shared by multiple strings.
string to convert to hex color.
value as valid hex color.
Inverse of objectToString, i.e., finally returns value as an object if value is a
valid JSON string, else returns defaultValue.
string to convert to object (optional, defaults to '').
object to return if value is not a valid JSON string (optional, defaults to {}).
value as an object.
Finally returns value with wrapper prepended & appended.
string to wrap value with.
Finally returns value with wrapper prepended & appended.
string to wrap.
Returns value in 'Title Case'.
string to alter.
value in 'Title Case'.
Returns a string containing digit characters (i.e., 0-9) in text.
string to return letters for.
Returns a string containing digits from text.
Returns a string containing letter characters (i.e., a-z with casing preserved) in text.
Spacing (excluding leading/trailing space characters, which are always removed) can be
optionally kept when keepSpacing is true, else all space characters are removed.
string to return letters for.
Whether to keep spacing in returned string (optional, defaults to false).
Returns a string containing letters from text.
Returns text as an array of numbers where each number is the incrementing number representation of letter characters where space character is considered the 0, 'a' is 1, etc. until 'z' which is 26.
string to return letters for.
Returns a string containing letters from text.
Finally returns an array of strings matching wordRegex.
Regular expression to detect words (optional, defaults to
omit non-alphanumeric characters before extracting space-delimited strings, letters, numbers,
and toWords within special cases like camelCase, etc.).
Finally returns an array of strings matching wordRegex.
string to alter.
Returns value without leading or trailing spaces.
string to trim.
value` without leading or trailing spaces.
Finally returns value truncated based on optional TruncateOptions.
Finally returns value truncated based on optional TruncateOptions.
Returns value in 'UPPER CASE'.
Value to alter.
value in 'UPPER CASE'.
Finally returns
trueifpredicatereturnstruefor all elements inarray, else returnsfalse.core
0.1.0
any