Pure functions for common tasks around collection types like arrays and objects.
Applies the given aggregator to each group in the given grouping, returning the results together with the respective group keys
Get array values type
Creates a record by associating each element of the input array with a key generated by the selector function.
Associates each string element of an array with a value returned by a selector function.
Splits the given array into chunks of the given size and returns them.
Merge deeply two objects
Merges the two given records, recursively merging any nested records with the second collection overriding the first in case of conflict.
Returns all distinct elements in the given array, preserving order by first occurrence.
Returns all elements in the given array that produce a unique value using the given discriminator, with the first matching occurrence retained.
Returns a new array that drops all elements in the given collection until the last element that does not match the given predicate.
Returns a new array that drops all elements in the given collection until the first element that does not match the given predicate.
Force intellisense to expand the typing to hide merging typings
Returns a new record with all entries of the given record except the ones that do not match the given predicate.
Returns a new record with all entries of the given record except the ones that have a key that does not match the given predicate.
Returns a new record with all entries of the given record except the ones that have a value that does not match the given predicate.
Returns an element if and only if that element is the only one matching the
given condition. Returns undefined
otherwise.
Applies the given selector to elements in the given array until a value is
produced that is neither null
nor undefined
and returns that value.
Returns undefined
if no such value is produced.
Returns true if the given value is part of the given object, otherwise it returns false.
Returns all distinct elements that appear at least once in each of the given arrays.
Composes a new record with all keys and values inverted.
Composes a new record with all keys and values inverted.
Return type for invertBy
.
Return type for invert
.
Transforms the elements in the given array to strings using the given
selector. Joins the produced strings into one using the given separator
and applying the given prefix
and suffix
to the whole string afterwards.
Applies the given transformer to all entries in the given record and returns a new record containing the results.
Applies the given transformer to all keys in the given record's entries and returns a new record containing the transformed entries.
Get map values types
Returns a new array, containing all elements in the given array transformed
using the given transformer, except the ones that were transformed to null
or undefined
.
Applies the given transformer to all values in the given record and returns a new record containing the resulting keys associated to the last value that produced them.
Get map values types
Returns the first element that is the largest value of the given function or undefined if there are no elements.
Applies the given selector to all elements of the provided collection and returns the max value of all elements. If an empty array is provided the function will return undefined.
Returns the first element having the largest value according to the provided comparator or undefined if there are no elements.
Merge two objects
Merge all sets types definitions from keys present in both objects
Merge all sets types definitions from keys present in both objects
Merge all records types definitions from keys present in both objects
Merge all sets types definitions from keys present in both objects
Merge two objects, with left precedence
Merging strategy
Returns the first element that is the smallest value of the given function or undefined if there are no elements.
Applies the given selector to all elements of the given collection and returns the min value of all elements. If an empty array is provided the function will return undefined.
Returns the first element having the smallest value according to the provided comparator or undefined if there are no elements.
Object with keys in either T or U but not in both
Creates a new object by excluding the specified keys from the provided object.
Exclude map, sets and array from type
Order option for SortByOptions
.
Filter of keys matching a given type
Returns a tuple of two arrays with the first one containing all elements in the given array that match the given predicate and the second one containing all that do not.
Returns a tuple of two records with the first one containing all entries of the given record that match the given predicate and the second one containing all that do not.
Builds all possible orders of all elements in the given array Ignores equality of elements, meaning this will always return the same number of permutations for a given length of input.
Creates a new object by including the specified keys from the provided object.
Applies the given reducer to each group in the given grouping, returning the results together with the respective group keys.
Calls the given reducer on each element of the given collection, passing its result as the accumulator to the next respective call, starting with the given initialValue. Returns all intermediate accumulator results.
Returns a random element from the given array.
Get set values type
Generates sliding views of the given array of the given size and returns a new array containing all of them.
Returns all elements in the given collection, sorted by their result using
the given selector. The selector function is called only once for each
element. Ascending or descending order can be specified through the order
option. By default, the elements are sorted in ascending order.
Applies the given selector to all elements in the given collection and calculates the sum of the results.
Returns all elements in the given array after the last element that does not match the given predicate.
Returns all elements in the given collection until the first element that does not match the given predicate.
Returns all distinct elements that appear in any of the given arrays.
Builds two separate arrays from the given array of 2-tuples, with the first returned array holding all first tuple elements and the second one holding all the second elements.
Returns an array excluding all given values.
Builds N-tuples of elements from the given N arrays with matching indices, stopping when the smallest array's end is reached.
Applies the given aggregator to each group in the given grouping, returning the results together with the respective group keys
Creates a record by associating each element of the input array with a key generated by the selector function.
Associates each string element of an array with a value returned by a selector function.
Splits the given array into chunks of the given size and returns them.
Get array values type
Merge deeply two objects
Merges the two given records, recursively merging any nested records with the second collection overriding the first in case of conflict.
Force intellisense to expand the typing to hide merging typings
Get map values types
Get map values types
Merge two objects
Merge all sets types definitions from keys present in both objects
Merge all sets types definitions from keys present in both objects
Merge all records types definitions from keys present in both objects
Merge all sets types definitions from keys present in both objects
Merge two objects, with left precedence
Merging strategy
Object with keys in either T or U but not in both
Exclude map, sets and array from type
Filter of keys matching a given type
Get set values type
Returns all distinct elements in the given array, preserving order by first occurrence.
Returns all elements in the given array that produce a unique value using the given discriminator, with the first matching occurrence retained.
Returns a new array that drops all elements in the given collection until the last element that does not match the given predicate.
Returns a new array that drops all elements in the given collection until the first element that does not match the given predicate.
Returns a new record with all entries of the given record except the ones that do not match the given predicate.
Returns a new record with all entries of the given record except the ones that have a key that does not match the given predicate.
Returns a new record with all entries of the given record except the ones that have a value that does not match the given predicate.
Returns an element if and only if that element is the only one matching the
given condition. Returns undefined
otherwise.
Applies the given selector to elements in the given array until a value is
produced that is neither null
nor undefined
and returns that value.
Returns undefined
if no such value is produced.
Returns true if the given value is part of the given object, otherwise it returns false.
Returns all distinct elements that appear at least once in each of the given arrays.
Composes a new record with all keys and values inverted.
Return type for invert
.
Composes a new record with all keys and values inverted.
Return type for invertBy
.
Transforms the elements in the given array to strings using the given
selector. Joins the produced strings into one using the given separator
and applying the given prefix
and suffix
to the whole string afterwards.
Applies the given transformer to all entries in the given record and returns a new record containing the results.
Applies the given transformer to all keys in the given record's entries and returns a new record containing the transformed entries.
Returns a new array, containing all elements in the given array transformed
using the given transformer, except the ones that were transformed to null
or undefined
.
Applies the given transformer to all values in the given record and returns a new record containing the resulting keys associated to the last value that produced them.
Returns the first element that is the largest value of the given function or undefined if there are no elements.
Applies the given selector to all elements of the provided collection and returns the max value of all elements. If an empty array is provided the function will return undefined.
Returns the first element having the largest value according to the provided comparator or undefined if there are no elements.
Returns the first element that is the smallest value of the given function or undefined if there are no elements.
Applies the given selector to all elements of the given collection and returns the min value of all elements. If an empty array is provided the function will return undefined.
Returns the first element having the smallest value according to the provided comparator or undefined if there are no elements.
Creates a new object by excluding the specified keys from the provided object.
Returns a tuple of two arrays with the first one containing all elements in the given array that match the given predicate and the second one containing all that do not.
Returns a tuple of two records with the first one containing all entries of the given record that match the given predicate and the second one containing all that do not.
Builds all possible orders of all elements in the given array Ignores equality of elements, meaning this will always return the same number of permutations for a given length of input.
Creates a new object by including the specified keys from the provided object.
Applies the given reducer to each group in the given grouping, returning the results together with the respective group keys.
Calls the given reducer on each element of the given collection, passing its result as the accumulator to the next respective call, starting with the given initialValue. Returns all intermediate accumulator results.
Returns a random element from the given array.
Generates sliding views of the given array of the given size and returns a new array containing all of them.
Order option for SortByOptions
.
Returns all elements in the given collection, sorted by their result using
the given selector. The selector function is called only once for each
element. Ascending or descending order can be specified through the order
option. By default, the elements are sorted in ascending order.
Applies the given selector to all elements in the given collection and calculates the sum of the results.
Returns all elements in the given array after the last element that does not match the given predicate.
Returns all elements in the given collection until the first element that does not match the given predicate.
Returns all distinct elements that appear in any of the given arrays.
Splits the given array into an array of chunks of the given size and returns them.
Returns an array that drops all elements in the given iterable until the last element that does not match the given predicate.
Returns an array that drops all elements in the given iterable until the first element that does not match the given predicate.
Returns all distinct elements that appear at least once in each of the given iterables.
Returns a random element from the given iterable.
Generates sliding views of the given iterable of the given size and returns an array containing all of them.
Types that can be compared with other values of the same type using comparison operators.
Order option for SortByOptions
.
Returns all elements in the given collection, sorted by their result using
the given selector. The selector function is called only once for each
element. Ascending or descending order can be specified through the order
option. By default, the elements are sorted in ascending order.
Returns all elements in the given iterable after the last element that does not match the given predicate.
Returns all elements in the given collection until the first element that does not match the given predicate.
Returns an array excluding all given values from an iterable.
Builds two separate arrays from the given array of 2-tuples, with the first returned array holding all first tuple elements and the second one holding all the second elements.
Returns an array excluding all given values.
Builds N-tuples of elements from the given N arrays with matching indices, stopping when the smallest array's end is reached.