npm package: @livechat/data-utils
Description: Collection of utility functions
Latest version: 1.0.4

## Functions

<dl>
<dt><a href="#add">add()</a></dt>
<dd><p>adds two numbers</p>
</dd>
<dt><a href="#hasOwn">hasOwn()</a></dt>
<dd><p>returns true or false depending if the provided property is present inside the provided object</p>
</dd>
<dt><a href="#assign">assign()</a></dt>
<dd><p>assigns properties of one or more source objects onto target object</p>
</dd>
<dt><a href="#capitalizeFirstLetter">capitalizeFirstLetter()</a></dt>
<dd><p>capitalizes first letter of string</p>
</dd>
<dt><a href="#flatMap">flatMap()</a></dt>
<dd><p>returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level</p>
</dd>
<dt><a href="#chain">chain()</a></dt>
<dd><p>takes two arguments: a function and either an array or another function. The function applies the input function to every element of the input array or to the result of calling the input function on the input array. Then, the results are concatenated into a new array and returned.</p>
</dd>
<dt><a href="#chunk">chunk()</a></dt>
<dd><p>chunks provided array to specified size chunks</p>
</dd>
<dt><a href="#isArray">isArray()</a></dt>
<dd><p>determines whether provided value is an array</p>
</dd>
<dt><a href="#isObject">isObject()</a></dt>
<dd><p>returns true or false depending if the provided value is an object</p>
</dd>
<dt><a href="#keys">keys()</a></dt>
<dd><p>returns an array of the provided object keys</p>
</dd>
<dt><a href="#mapValues">mapValues()</a></dt>
<dd><p>maps values of the provided object</p>
</dd>
<dt><a href="#cloneDeep">cloneDeep()</a></dt>
<dd><p>returns an exact clone of the provided value with a new reference</p>
</dd>
<dt><a href="#camelCase">camelCase()</a></dt>
<dd><p>converts provided string to camel case</p>
</dd>
<dt><a href="#compact">compact()</a></dt>
<dd><p>removes all nullish and NaN values from the provided object or array</p>
</dd>
<dt><a href="#compose">compose()</a></dt>
<dd><p>returns a composed value from the provided arguments</p>
</dd>
<dt><a href="#debounce">debounce()</a></dt>
<dd><p>delays the execution of a function until a certain period of time has passed without the function being called again</p>
</dd>
<dt><a href="#deepMapKeys">deepMapKeys()</a></dt>
<dd><p>recurses through an object and transforms its keys – and the keys of any nested objects – based on the provided key mapping function</p>
</dd>
<dt><a href="#deepMerge">deepMerge()</a></dt>
<dd><p>deep merges provided objects by assigning the sources onto the target object passed as the first argument</p>
</dd>
<dt><a href="#isNil">isNil()</a></dt>
<dd><p>returns true or false depending if the provided value is null or undefined</p>
</dd>
<dt><a href="#defaultTo">defaultTo()</a></dt>
<dd><p>returns a function that invoked with a null or undefined values returns the provided default</p>
</dd>
<dt><a href="#diffKeys">diffKeys()</a></dt>
<dd><p>returns an array of keys of the object passed as the first argument that are not present, or that are present, but have different values, in object passed as the second argument</p>
</dd>
<dt><a href="#drop">drop()</a></dt>
<dd><p>drops specific amount of elements of the provided array starting at the beginning</p>
</dd>
<dt><a href="#dropRight">dropRight()</a></dt>
<dd><p>drops specific amount of elements of the provided array starting at the end</p>
</dd>
<dt><a href="#ensureArray">ensureArray()</a></dt>
<dd><p>returns an array if an array was provided, or a new array if provided value was not an array</p>
</dd>
<dt><a href="#entries">entries()</a></dt>
<dd><p>returns an array of entries of the provided object</p>
</dd>
<dt><a href="#find">find()</a></dt>
<dd><p>returns the first element of the provided array that returns true for the predicate function, or undefined if the element was not found</p>
</dd>
<dt><a href="#findIndex">findIndex()</a></dt>
<dd><p>returns the index of the element of the provided array that returns true for the predicate function, or -1 if the element was not found</p>
</dd>
<dt><a href="#findKey">findKey()</a></dt>
<dd><p>returns the key of the provided object that returns true for the predicate function, or undefined if the key was not found</p>
</dd>
<dt><a href="#findLast">findLast()</a></dt>
<dd><p>returns the last element of the provided array that returns true for the predicate function, or undefined if the element was not found</p>
</dd>
<dt><a href="#findLastIndexFrom">findLastIndexFrom()</a></dt>
<dd><p>returns the index of the last element of the provided array that returns true for the predicate function, starting from the specified index element to the begining of the array, or -1 if the element was not found</p>
</dd>
<dt><a href="#findLastIndex">findLastIndex()</a></dt>
<dd><p>returns the index of the last element of the provided array that returns true for the predicate function, or -1 if the element was not found</p>
</dd>
<dt><a href="#filledArray">filledArray()</a></dt>
<dd><p>returns an array of requested length filled with provided value</p>
</dd>
<dt><a href="#identity">identity()</a></dt>
<dd><p>returns the provided value</p>
</dd>
<dt><a href="#flatten">flatten()</a></dt>
<dd><p>flattens the provided array by one level</p>
</dd>
<dt><a href="#forOwn">forOwn()</a></dt>
<dd><p>invokes the provided callback for each of the provided object fields</p>
</dd>
<dt><a href="#fromPairs">fromPairs()</a></dt>
<dd><p>returns an object constructed from the provided array of key, value pairs&#39;</p>
</dd>
<dt><a href="#generateRandomId">generateRandomId()</a></dt>
<dd><p>generates a random id</p>
</dd>
<dt><a href="#generateUniqueId">generateUniqueId()</a></dt>
<dd><p>generates an unique id based on the provided object keys</p>
</dd>
<dt><a href="#get">get()</a></dt>
<dd><p>returns the value from the specififed path from the provided object</p>
</dd>
<dt><a href="#getOr">getOr()</a></dt>
<dd><p>returns the value from the specififed path from the provided object or the default value if the path element was not found</p>
</dd>
<dt><a href="#groupBy">groupBy()</a></dt>
<dd><p>groups values from the provided array or object based on the result of the provided mapper function</p>
</dd>
<dt><a href="#groupKeys">groupKeys()</a></dt>
<dd><p>groups values from the provided object based on the result of the provided key mapping function</p>
</dd>
<dt><a href="#includes">includes()</a></dt>
<dd><p>returns true or false depending if the provided value is present inside the provided array or string</p>
</dd>
<dt><a href="#isEmpty">isEmpty()</a></dt>
<dd><p>returns true or false depending if the provided value is an empty object or an empty array</p>
</dd>
<dt><a href="#isFalsy">isFalsy()</a></dt>
<dd><p>returns true or false depending if the provided value is falsy</p>
</dd>
<dt><a href="#isTruthy">isTruthy()</a></dt>
<dd><p>returns true or false depending if the provided value is truthy</p>
</dd>
<dt><a href="#isPromise">isPromise()</a></dt>
<dd><p>returns true or false depending if the provided value is a Promise</p>
</dd>
<dt><a href="#keyBy">keyBy()</a></dt>
<dd><p>constructs an object from the provided array of objects, grouped by the value of the specified key</p>
</dd>
<dt><a href="#last">last()</a></dt>
<dd><p>returns the last element of the provided array or undefined when array is empty</p>
</dd>
<dt><a href="#mapKeys">mapKeys()</a></dt>
<dd><p>maps keys of the provided object</p>
</dd>
<dt><a href="#mapValuesIndexed">mapValuesIndexed()</a></dt>
<dd><p>maps values and keys of the provided object</p>
</dd>
<dt><a href="#merge">merge()</a></dt>
<dd><p>deep merges the two provided objects</p>
</dd>
<dt><a href="#mergeAll">mergeAll()</a></dt>
<dd><p>deep merges all provided objects</p>
</dd>
<dt><a href="#memoizeWith">memoizeWith()</a></dt>
<dd><p>memoizes the provided function so it returns cached results but based on the provided key resolver</p>
</dd>
<dt><a href="#memoize">memoize()</a></dt>
<dd><p>memoizes the provided function so it returns cached results when invoked with the same arguments</p>
</dd>
<dt><a href="#memoizeOne">memoizeOne()</a></dt>
<dd><p>memoizes the provided function so it returns cached results but only with one cache key</p>
</dd>
<dt><a href="#noop">noop()</a></dt>
<dd><p>does literally nothing</p>
</dd>
<dt><a href="#values">values()</a></dt>
<dd><p>returns an array of values of the provided object</p>
</dd>
<dt><a href="#numericSortBy">numericSortBy()</a></dt>
<dd><p>sorts values of the provided object or array based on the provided mapping function or the provided prop string</p>
</dd>
<dt><a href="#omitByIndexed">omitByIndexed()</a></dt>
<dd><p>returns an object the same as the provided one but without the fields omitted by the predicate function</p>
</dd>
<dt><a href="#omit">omit()</a></dt>
<dd><p>returns the provided object but with specified keys omitted</p>
</dd>
<dt><a href="#omitBy">omitBy()</a></dt>
<dd><p>returns an object same as the provided one but without the fields omitted by the predicate function</p>
</dd>
<dt><a href="#once">once()</a></dt>
<dd><p>returns a particular function to be executed only a single time</p>
</dd>
<dt><a href="#over">over()</a></dt>
<dd><p>returns a function that called invokes the provided array of functions with the call arguments</p>
</dd>
<dt><a href="#takeLast">takeLast()</a></dt>
<dd><p>returns the specified amount of the provided array elements starting from the end</p>
</dd>
<dt><a href="#overArgs">overArgs()</a></dt>
<dd><p>returns a function that called invokes the provided arguments transformers</p>
</dd>
<dt><a href="#pair">pair()</a></dt>
<dd><p>returns a tuple from the two provided values</p>
</dd>
<dt><a href="#partitionObject">partitionObject()</a></dt>
<dd><p>returns a tuple of valid and invalid parts of the object as defined in validation function passed in the first argument</p>
</dd>
<dt><a href="#pick">pick()</a></dt>
<dd><p>picks specified properties from the object</p>
</dd>
<dt><a href="#pickBy">pickBy()</a></dt>
<dd><p>returns an object same as the provided one but with the fields picked by the predicate function</p>
</dd>
<dt><a href="#pickByIndexed">pickByIndexed()</a></dt>
<dd><p>returns an object same as the provided one but with the fields picked by the predicate function</p>
</dd>
<dt><a href="#pickOwn">pickOwn()</a></dt>
<dd><p>picks specified props only if they exist on the provided object</p>
</dd>
<dt><a href="#randomInt">randomInt()</a></dt>
<dd><p>returns a random integer number between the specified min and max values</p>
</dd>
<dt><a href="#range">range()</a></dt>
<dd><p>returns an array filled with numbers in an ascending order to the provided max value</p>
</dd>
<dt><a href="#reject">reject()</a></dt>
<dd><p>returns an array with elements that return false for the provided predicate function</p>
</dd>
<dt><a href="#removeAt">removeAt()</a></dt>
<dd><p>returns the provided array without the specified index element</p>
</dd>
<dt><a href="#set">set()</a></dt>
<dd><p>sets the property of the provided object specified by the provided path in form of a string or an array of keys</p>
</dd>
<dt><a href="#shallowEqual">shallowEqual()</a></dt>
<dd><p>returns true if the provided values are shallow equal</p>
</dd>
<dt><a href="#shortenLongText">shortenLongText()</a></dt>
<dd><p>shortens the provided string by the specified amount</p>
</dd>
<dt><a href="#sign">sign()</a></dt>
<dd><p>returns a sign of the provided number or NaN if value different than number was provided</p>
</dd>
<dt><a href="#shuffle">shuffle()</a></dt>
<dd><p>returns an array with the provided array values shuffled</p>
</dd>
<dt><a href="#sliceDiff">sliceDiff()</a></dt>
<dd><p>returns the diff object from the provided object and slice comparison</p>
</dd>
<dt><a href="#snakeCase">snakeCase()</a></dt>
<dd><p>snake cases the provided string</p>
</dd>
<dt><a href="#someAreTruthy">someAreTruthy()</a></dt>
<dd><p>returns true if some of the array values is truthy</p>
</dd>
<dt><a href="#splitAt">splitAt()</a></dt>
<dd><p>splits an array or a string at the given index</p>
</dd>
<dt><a href="#splitRightWhenAccum">splitRightWhenAccum()</a></dt>
<dd><p>returns a tuple with the provided array splited on an element that returned true for the provided function, iterating from the right side</p>
</dd>
<dt><a href="#spread">spread()</a></dt>
<dd><p>returns a function that called with an array of values calls the provided function with the spreaded arguments from the array arguments</p>
</dd>
<dt><a href="#sum">sum()</a></dt>
<dd><p>returns a sum of all the provided array number values</p>
</dd>
<dt><a href="#take">take()</a></dt>
<dd><p>returns the specified amount of the provided array elements starting from the beginning</p>
</dd>
<dt><a href="#takeRightWhileFrom">takeRightWhileFrom()</a></dt>
<dd><p>takes elements while <code>predicate</code> returns true starting from the right from the specified index</p>
</dd>
<dt><a href="#takeRightWhile">takeRightWhile()</a></dt>
<dd><p>takes elements while <code>predicate</code> returns true</p>
</dd>
<dt><a href="#throttle">throttle()</a></dt>
<dd><p>ensures that a function is executed at a fixed interval, so that it is not called too frequently</p>
</dd>
<dt><a href="#toArray">toArray()</a></dt>
<dd><p>converts values that are iterable to an array</p>
</dd>
<dt><a href="#toFixedNumber">toFixedNumber()</a></dt>
<dd><p>returns the provided number with specified amount of decimal digits</p>
</dd>
<dt><a href="#toPairs">toPairs()</a></dt>
<dd><p>returns an array of derived from the provided object key-value tuples</p>
</dd>
<dt><a href="#trailingThrottle">trailingThrottle()</a></dt>
<dd><p>ensures that a function is executed at a fixed interval, so that it is not called too frequently</p>
</dd>
<dt><a href="#leadingThrottle">leadingThrottle()</a></dt>
<dd><p>ensures that a function is executed at a fixed interval, so that it is not called too frequently</p>
</dd>
<dt><a href="#stringCompare">stringCompare()</a></dt>
<dd><p>returns 0 for matching strings
return -1 for string with lower char code at some position
return 1 for string with greater char code at some position</p>
</dd>
<dt><a href="#trimStart">trimStart()</a></dt>
<dd><p>trims the beginning whitespaces from the provided string</p>
</dd>
<dt><a href="#trimEnd">trimEnd()</a></dt>
<dd><p>trims the end whitespaces from the provided string</p>
</dd>
<dt><a href="#repeat">repeat()</a></dt>
<dd><p>returns the provided string repeated the specified amount of times</p>
</dd>
<dt><a href="#uniqBy">uniqBy()</a></dt>
<dd><p>returns an array with all the duplicates from the provided array removed based on the iteratee function</p>
</dd>
<dt><a href="#uniq">uniq()</a></dt>
<dd><p>returns an array with all the duplicates from the provided array removed</p>
</dd>
<dt><a href="#update">update()</a></dt>
<dd><p>updates the provided array with the provided value on the specified index</p>
</dd>
<dt><a href="#without">without()</a></dt>
<dd><p>returns an array without the specified elements from the provided array</p>
</dd>
<dt><a href="#zipWith">zipWith()</a></dt>
<dd><p>returns an array of tuples of certain index elements from two provided arrays based on the zipper function</p>
</dd>
<dt><a href="#zip">zip()</a></dt>
<dd><p>returns an array of tuples of certain index elements from two provided arrays</p>
</dd>
</dl>

<a name="add"></a>

## add()

adds two numbers

**Kind**: global function  
**Example**

```js
add(1, 2)
// returns 3
```

<a name="hasOwn"></a>

## hasOwn()

returns true or false depending if the provided property is present inside the provided object

**Kind**: global function  
**Example**

```js
hasOwn('a', { a: 1, b: 2 })
// returns true
```

<a name="assign"></a>

## assign()

assigns properties of one or more source objects onto target object

**Kind**: global function  
**Example**

```js
assign({ a: 1, b: 2 }, { b: 4, c: 5 })
// returns { a: 1, b: 4, c: 5 }
```

<a name="capitalizeFirstLetter"></a>

## capitalizeFirstLetter()

capitalizes first letter of string

**Kind**: global function  
**Example**

```js
capitalizeFirstLetter('hello')
// returns 'Hello'
```

<a name="flatMap"></a>

## flatMap()

returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level

**Kind**: global function  
**Example**

```js
const arr = [{ a: [1, 2] }, { a: [3, 4] }, { a: [5, 6] }]
flatMap(el => el.a, arr)
// returns [1, 2, 3, 4, 5, 6]
```

<a name="chain"></a>

## chain()

takes two arguments: a function and either an array or another function. The function applies the input function to every element of the input array or to the result of calling the input function on the input array. Then, the results are concatenated into a new array and returned.

**Kind**: global function  
**Example**

```js
chain(n => [n, n], [1, 2, 3])
// returns [1, 1, 2, 2, 3, 3]
const head = list => list[0]
const append = el => list => list.concat(el)
chain(append, head)([1, 2, 3])
// returns [1, 2, 3, 1]
```

<a name="chunk"></a>

## chunk()

chunks provided array to specified size chunks

**Kind**: global function  
**Example**

```js
chunk([1, 2, 3, 4], 2)
// returns [[1, 2], [3, 4]]
```

<a name="isArray"></a>

## isArray()

determines whether provided value is an array

**Kind**: global function  
**Example**

```js
isArray([1, 2])
// returns true
isArray('hello')
// returns false
```

<a name="isObject"></a>

## isObject()

returns true or false depending if the provided value is an object

**Kind**: global function  
**Example**

```js
isObject({ a: 1 })
// returns true
isObject([1, 2])
// returns false
```

<a name="keys"></a>

## keys()

returns an array of the provided object keys

**Kind**: global function  
**Example**

```js
keys({ a: 1, b: 2, c: 3 })
// returns ['a', 'b', 'c']
```

<a name="mapValues"></a>

## mapValues()

maps values of the provided object

**Kind**: global function  
**Example**

```js
mapValues(val => val.toUpperCase(), { a: 'foo', b: 'bar' })
// returns { a: 'FOO', b: 'BAR' }
```

<a name="cloneDeep"></a>

## cloneDeep()

returns an exact clone of the provided value with a new reference

**Kind**: global function  
**Example**

```js
cloneDeep({ a: 1, b: 2 })
// returns { a: 1, b: 2 }
```

<a name="camelCase"></a>

## camelCase()

converts provided string to camel case

**Kind**: global function  
**Example**

```js
camelCase('hello_world')
// returns 'helloWorld'
```

<a name="compact"></a>

## compact()

removes all nullish and NaN values from the provided object or array

**Kind**: global function  
**Example**

```js
compact({ a: 1, b: null })
// returns { a: 1 }
compact(['hello', undefined])
// returns ['hello']
```

<a name="compose"></a>

## compose()

returns a composed value from the provided arguments

**Kind**: global function  
**Example**

```js
const f3 = (a: string) => `f3(${a})`
const f2 = (a: string) => `f2(${a})`
const f1 = (a: string) => `f1(${a})`
compose(f3, f2, f1)('arg')
// returns 'f3(f2(f1(arg)))'
```

<a name="debounce"></a>

## debounce()

delays the execution of a function until a certain period of time has passed without the function being called again

**Kind**: global function  
**Example**

```js
debounce(1000, someFunction)
```

<a name="deepMapKeys"></a>

## deepMapKeys()

recurses through an object and transforms its keys – and the keys of any nested objects – based on the provided key mapping function

**Kind**: global function  
**Example**

```js
deepMapKeys(key => `test_${key}`, { a: 1, b: { c: 2 } })
// returns { test_a: 1, test_b: { test_c: 2 } }
```

<a name="deepMerge"></a>

## deepMerge()

deep merges provided objects by assigning the sources onto the target object passed as the first argument

**Kind**: global function  
**Example**

```js
deepMerge({ a: 1, b: { c: 2 } }, { b: { d: 3 } })
// returns { a: 1, b: { c: 2, d: 3 } }
```

<a name="isNil"></a>

## isNil()

returns true or false depending if the provided value is null or undefined

**Kind**: global function  
**Example**

```js
isNil(null)
// returns true
```

<a name="defaultTo"></a>

## defaultTo()

returns a function that invoked with a null or undefined values returns the provided default

**Kind**: global function  
**Example**

```js
const defaulter = defaultTo('default')
defaulter('hello')
// returns 'hello'
defaulter(null)
// returns 'default'
```

<a name="diffKeys"></a>

## diffKeys()

returns an array of keys of the object passed as the first argument that are not present, or that are present, but have different values, in object passed as the second argument

**Kind**: global function  
**Example**

```js
diffKeys({ a: 1, b: 2, c: 3 }, { c: 3, d: 4 })
// returns ['a', 'b']
```

<a name="drop"></a>

## drop()

drops specific amount of elements of the provided array starting at the beginning

**Kind**: global function  
**Example**

```js
drop(2, [1, 2, 3, 4])
// returns [3, 4]
```

<a name="dropRight"></a>

## dropRight()

drops specific amount of elements of the provided array starting at the end

**Kind**: global function  
**Example**

```js
dropRight(2, [1, 2, 3, 4])
// returns [1, 2]
```

<a name="ensureArray"></a>

## ensureArray()

returns an array if an array was provided, or a new array if provided value was not an array

**Kind**: global function  
**Example**

```js
ensureArray([1, 2])
// returns [1, 2]
ensureArray('test')
// returns ['test']
```

<a name="entries"></a>

## entries()

returns an array of entries of the provided object

**Kind**: global function  
**Example**

```js
entries({ a: 1, b: 2 })
// returns [['a', 1], ['b', 2]]
```

<a name="find"></a>

## find()

returns the first element of the provided array that returns true for the predicate function, or undefined if the element was not found

**Kind**: global function  
**Example**

```js
find(el => el === 2, [1, 2, 3])
// returns 2
```

<a name="findIndex"></a>

## findIndex()

returns the index of the element of the provided array that returns true for the predicate function, or -1 if the element was not found

**Kind**: global function  
**Example**

```js
findIndex(el => el === 2, [1, 2, 3])
// returns 1
findIndex(el => el === 5, [1, 2, 3])
// returns -1
```

<a name="findKey"></a>

## findKey()

returns the key of the provided object that returns true for the predicate function, or undefined if the key was not found

**Kind**: global function  
**Example**

```js
findKey(el => el === 1, { a: 1, b: { c: 2 } })
// returns 'a'
findKey(el => el === 2, { a: 1, b: { c: 2 } })
// returns undefined
```

<a name="findLast"></a>

## findLast()

returns the last element of the provided array that returns true for the predicate function, or undefined if the element was not found

**Kind**: global function  
**Example**

```js
findLast(el => el % 2 === 0, [1, 2, 3, 4])
// returns 4
```

<a name="findLastIndexFrom"></a>

## findLastIndexFrom()

returns the index of the last element of the provided array that returns true for the predicate function, starting from the specified index element to the begining of the array, or -1 if the element was not found

**Kind**: global function  
**Example**

```js
findLastIndexFrom(el => el % 2 === 0, 3, [1, 2, 3, 4, 5, 6])
// returns 3
```

<a name="findLastIndex"></a>

## findLastIndex()

returns the index of the last element of the provided array that returns true for the predicate function, or -1 if the element was not found

**Kind**: global function  
**Example**

```js
findLastIndex(el => el % 2 === 0, [1, 2, 3, 4])
// returns 3
```

<a name="filledArray"></a>

## filledArray()

returns an array of requested length filled with provided value

**Kind**: global function  
**Example**

```js
filledArray(3, 1)
// returns [1, 1, 1]
```

<a name="identity"></a>

## identity()

returns the provided value

**Kind**: global function  
**Example**

```js
identity('hello')
// returns 'hello'
```

<a name="flatten"></a>

## flatten()

flattens the provided array by one level

**Kind**: global function  
**Example**

```js
flatten([1, 2, [3, 4]])
// returns [1, 2, 3, 4]
flatten([1, 2, [3, [4, 5]], 6])
// returns [1, 2, 3, [4, 5], 6]
```

<a name="forOwn"></a>

## forOwn()

invokes the provided callback for each of the provided object fields

**Kind**: global function  
**Example**

```js
const obj = { a: 1, b: 2, c: 3 }
const arr: string[] = []
forOwn(el => arr.push(el.toString()), obj)
// arr equals ['1', '2', '3']
```

<a name="fromPairs"></a>

## fromPairs()

returns an object constructed from the provided array of key, value pairs'

**Kind**: global function  
**Example**

```js
const arr = [
  ['a', 1],
  ['b', 2],
  ['c', 3],
]
fromPairs(arr)
// returns { a: 1, b: 2, c: 3 }
```

<a name="generateRandomId"></a>

## generateRandomId()

generates a random id

**Kind**: global function  
**Example**

```js
generateRandomId()
// returns 'd1rjknhhch8'
```

<a name="generateUniqueId"></a>

## generateUniqueId()

generates an unique id based on the provided object keys

**Kind**: global function  
**Example**

```js
generateUniqueId({ xuvarw8cao: 1, b837g2nba1d: 2 })
// returns 'd1rjknhhch8'
```

<a name="get"></a>

## get()

returns the value from the specififed path from the provided object

**Kind**: global function  
**Example**

```js
const obj = { a: { b: [1, 2, 3] } }
get('a.b.1', obj)
// returns 2
get(['a', 'b', '1'], obj)
// returns 2
```

<a name="getOr"></a>

## getOr()

returns the value from the specififed path from the provided object or the default value if the path element was not found

**Kind**: global function  
**Example**

```js
const obj = { a: { b: [1, 2, 3] } }
getOr(null, 'a.b.1', obj)
// returns 2
getOr(null, 'a.c', obj)
// returns null
```

<a name="groupBy"></a>

## groupBy()

groups values from the provided array or object based on the result of the provided mapper function

**Kind**: global function  
**Example**

```js
const arr = [
  { a: 1, b: 2 },
  { a: 2, b: 4 },
  { a: 3, b: 6 },
]
groupBy(el => (el.a % 2 === 0 ? 'even' : 'odd'), arr)
// returns {
// 	odd: [
// 		{ a: 1, b: 2 },
// 		{ a: 3, b: 6 },
// 	],
// 	even: [{ a: 2, b: 4 }],
// }
```

<a name="groupKeys"></a>

## groupKeys()

groups values from the provided object based on the result of the provided key mapping function

**Kind**: global function  
**Example**

```js
const obj = { a: 1, b: 2, c: 3 }
groupKeys(el => (el === 'a' ? 'aaa' : 'rest'), obj)
// returns {
//	aaa: { a: 1 },
//	rest: { b: 2, c: 3 },
// }
```

<a name="includes"></a>

## includes()

returns true or false depending if the provided value is present inside the provided array or string

**Kind**: global function  
**Example**

```js
includes('a', ['a', 'b', 'c'])
// returns true
includes('d', 'abc')
// returns false
```

<a name="isEmpty"></a>

## isEmpty()

returns true or false depending if the provided value is an empty object or an empty array

**Kind**: global function  
**Example**

```js
isEmpty({})
// returns true
```

<a name="isFalsy"></a>

## isFalsy()

returns true or false depending if the provided value is falsy

**Kind**: global function  
**Example**

```js
isFalsy(0)
// returns true
```

<a name="isTruthy"></a>

## isTruthy()

returns true or false depending if the provided value is truthy

**Kind**: global function  
**Example**

```js
isTruthy(1)
// returns true
```

<a name="isPromise"></a>

## isPromise()

returns true or false depending if the provided value is a Promise

**Kind**: global function  
**Example**

```js
isPromise(new Promise(res => res(null)))
// returns true
```

<a name="keyBy"></a>

## keyBy()

constructs an object from the provided array of objects, grouped by the value of the specified key

**Kind**: global function  
**Example**

```js
const arr = [
  { a: 'foo', b: 'bar' },
  { a: 'foo', b: 'baz' },
  { a: 'test', b: 'bab' },
]
keyBy('a', arr)
// returns { foo: { a: 'foo', b: 'baz' }, test: { a: 'test', b: 'bab' } }
```

<a name="last"></a>

## last()

returns the last element of the provided array or undefined when array is empty

**Kind**: global function  
**Example**

```js
last([1, 2, 3])
// returns 3
```

<a name="mapKeys"></a>

## mapKeys()

maps keys of the provided object

**Kind**: global function  
**Example**

```js
mapKeys(key => key.toUpperCase(), { a: 1, b: 2 })
// returns { A: 1, B: 2 }
```

<a name="mapValuesIndexed"></a>

## mapValuesIndexed()

maps values and keys of the provided object

**Kind**: global function  
**Example**

```js
mapValuesIndexed((val, key) => `${key}-${val}`, { a: 1, b: 2 })
// returns { a: 'a-1', b: 'b-2' }
```

<a name="merge"></a>

## merge()

deep merges the two provided objects

**Kind**: global function  
**Example**

```js
merge({ a: 1 }, { b: 2 })
// returns { a: 1, b: 2 }
```

<a name="mergeAll"></a>

## mergeAll()

deep merges all provided objects

**Kind**: global function  
**Example**

```js
mergeAll({ a: 1 }, { b: 2 }, { c: 3 })
// returns { a: 1, b: 2, c: 3 }
```

<a name="memoizeWith"></a>

## memoizeWith()

memoizes the provided function so it returns cached results but based on the provided key resolver

**Kind**: global function  
**Example**

```js
const memoizedFunc = memoizeWith(
  key => (key === 'a' ? key : 'bar'),
  (val: string) => ({ current: val }),
)
memoizedFunc('a') === memoizedFunc('a') // true
memoizedFunc('b') === memoizedFunc('c') // true
```

<a name="memoize"></a>

## memoize()

memoizes the provided function so it returns cached results when invoked with the same arguments

**Kind**: global function  
**Example**

```js
const memoizedFunc = memoize((val: number) => ({ current: val })
memoizedFunc(3) === memoizedFunc(3)
// returns true
```

<a name="memoizeOne"></a>

## memoizeOne()

memoizes the provided function so it returns cached results but only with one cache key

**Kind**: global function  
**Example**

```js
const memoizedFunc = memoizeOne((val: number) => ({ current: val })

const resultFor1 = memoizedFunc(1) // { current: 1 }
resultFor1 === memoizedFunc(1) // true
resultFor1 === memoizedFunc(1) // true

const resultFor2 = memoizedFunc(2) // { current: 2 }
resultFor2 === memoizedFunc(2) // true
resultFor1 === memoizedFunc(1) // false
```

<a name="noop"></a>

## noop()

does literally nothing

**Kind**: global function  
**Example**

```js
somethingAsyncAndDangerous().catch(noop)
```

<a name="values"></a>

## values()

returns an array of values of the provided object

**Kind**: global function  
**Example**

```js
values({ a: 1, b: 2, c: 3 })
// returns [1, 2, 3]
```

<a name="numericSortBy"></a>

## numericSortBy()

sorts values of the provided object or array based on the provided mapping function or the provided prop string

**Kind**: global function  
**Example**

```js
const obj = {
  a: { chats: 1 },
  b: { chats: 3 },
  c: { chats: 2 },
}
numericSortBy(el => el.chats * -1, obj)
// returns [{ chats: 3 }, { chats: 2 }, { chats: 1 }]
```

<a name="omitByIndexed"></a>

## omitByIndexed()

returns an object the same as the provided one but without the fields omitted by the predicate function

**Kind**: global function  
**Example**

```js
omitByIndexed((val, key) => key === 'b', { a: 1, b: 2, c: 3 })
// returns { a: 1, c: 3 }
```

<a name="omit"></a>

## omit()

returns the provided object but with specified keys omitted

**Kind**: global function  
**Example**

```js
omit(['a'], { a: 1, b: 2 })
// returns { b: 2 }
```

<a name="omitBy"></a>

## omitBy()

returns an object same as the provided one but without the fields omitted by the predicate function

**Kind**: global function  
**Example**

```js
omitBy(el => el % 2 === 0, { a: 1, b: 2, c: 3 })
// returns { a: 1, c: 3 }
```

<a name="once"></a>

## once()

returns a particular function to be executed only a single time

**Kind**: global function  
**Example**

```js
const results = [1, 2, 3, 4, 5]
const getResult = once(() => results.pop())
getResult() // 5
getResult() // 5
getResult() // 5
```

<a name="over"></a>

## over()

returns a function that called invokes the provided array of functions with the call arguments

**Kind**: global function  
**Example**

```js
const func = over([val => val + 1, val => val * 10, Boolean])
func(1)
// returns [2, 10, true]
```

<a name="takeLast"></a>

## takeLast()

returns the specified amount of the provided array elements starting from the end

**Kind**: global function  
**Example**

```js
takeLast(2, ['a', 'b', 'c', 'd'])
// returns ['c', 'd']
```

<a name="overArgs"></a>

## overArgs()

returns a function that called invokes the provided arguments transformers

**Kind**: global function  
**Example**

```js
const func = overArgs((a, b, c) => [a, b, c], [n => n * n, Boolean])
func(2, 0, 1)
// returns [4, false, 1]
```

<a name="pair"></a>

## pair()

returns a tuple from the two provided values

**Kind**: global function  
**Example**

```js
pair('a', 'b')
// returns ['a', 'b']
```

<a name="partitionObject"></a>

## partitionObject()

returns a tuple of valid and invalid parts of the object as defined in validation function passed in the first argument

**Kind**: global function  
**Example**

```js
partitionObject(el => el % 2 === 0, { a: 1, b: 2, c: 3 })
// returns [{ b: 2 }, { a: 1, c: 3 }]
```

<a name="pick"></a>

## pick()

picks specified properties from the object

**Kind**: global function  
**Example**

```js
pick(['b'], { a: 1, b: 2 })
// returns { b: 2 }
```

<a name="pickBy"></a>

## pickBy()

returns an object same as the provided one but with the fields picked by the predicate function

**Kind**: global function  
**Example**

```js
pickBy(el => el % 2 === 0, { a: 1, b: 2, c: 3 })
// returns { b: 2 }
```

<a name="pickByIndexed"></a>

## pickByIndexed()

returns an object same as the provided one but with the fields picked by the predicate function

**Kind**: global function  
**Example**

```js
pickByIndexed((val, key) => key === 'b', { a: 1, b: 2, c: 3 })
// returns { b: 2 }
```

<a name="pickOwn"></a>

## pickOwn()

picks specified props only if they exist on the provided object

**Kind**: global function  
**Example**

```js
pickOwn(['b'], { a: 1, b: 2 })
// returns { b: 2 }
```

<a name="randomInt"></a>

## randomInt()

returns a random integer number between the specified min and max values

**Kind**: global function  
**Example**

```js
randomInt(0, 10)
// returns 7
```

<a name="range"></a>

## range()

returns an array filled with numbers in an ascending order to the provided max value

**Kind**: global function  
**Example**

```js
range(5)
// returns [0, 1, 2, 3, 4, 5]
```

<a name="reject"></a>

## reject()

returns an array with elements that return false for the provided predicate function

**Kind**: global function  
**Example**

```js
reject(el => el % 2 === 0, [1, 2, 3, 4, 5])
// returns [1, 3, 5]
```

<a name="removeAt"></a>

## removeAt()

returns the provided array without the specified index element

**Kind**: global function  
**Example**

```js
removeAt(2, [1, 2, 3, 4, 5])
// returns [1, 2, 4, 5]
```

<a name="set"></a>

## set()

sets the property of the provided object specified by the provided path in form of a string or an array of keys

**Kind**: global function  
**Example**

```js
const obj = { a: 1, b: { c: 2 } }
set('b.d', 3, obj)
// returns { a: 1, b: { c: 2, d: 3 } }
set(['b', 'd'], 3, obj)
// returns { a: 1, b: { c: 2, d: 3 } }
```

<a name="shallowEqual"></a>

## shallowEqual()

returns true if the provided values are shallow equal

**Kind**: global function  
**Example**

```js
shallowEqual({ a: 1 }, { a: 1 })
// returns true
shallowEqual({ a: { b: 1 } }, { a: { b: 1 } })
// returns false
```

<a name="shortenLongText"></a>

## shortenLongText()

shortens the provided string by the specified amount

**Kind**: global function  
**Example**

```js
shortenLongText(5, 'Lorem ipsum dolor')
// returns 'Lorem...'
```

<a name="sign"></a>

## sign()

returns a sign of the provided number or NaN if value different than number was provided

**Kind**: global function  
**Example**

```js
sign(10)
// returns 1
sign(-8)
// returns -1
```

<a name="shuffle"></a>

## shuffle()

returns an array with the provided array values shuffled

**Kind**: global function  
**Example**

```js
shuffle([1, 2, 3, 4])
// returns [4, 1, 3, 2]
```

<a name="sliceDiff"></a>

## sliceDiff()

returns the diff object from the provided object and slice comparison

**Kind**: global function  
**Example**

```js
sliceDiff({ a: 1, b: 10, g: 3 }, { a: 1, b: 2, c: 3 })
// returns { b: 10, g: 3 }
```

<a name="snakeCase"></a>

## snakeCase()

snake cases the provided string

**Kind**: global function  
**Example**

```js
snakeCase('helloWorld')
// returns 'hello_world'
```

<a name="someAreTruthy"></a>

## someAreTruthy()

returns true if some of the array values is truthy

**Kind**: global function  
**Example**

```js
someAreTruthy([0, 1, 2])
// returns true
```

<a name="splitAt"></a>

## splitAt()

splits an array or a string at the given index

**Kind**: global function  
**Example**

```js
splitAt(2, [1, 2, 3, 4, 5])
// returns [[1, 2], [3, 4, 5]]
splitAt(2, 'foobar')
// returns ['fo', 'obar']
```

<a name="splitRightWhenAccum"></a>

## splitRightWhenAccum()

returns a tuple with the provided array splited on an element that returned true for the provided function, iterating from the right side

**Kind**: global function  
**Example**

```js
splitRightWhenAccum((el, acc) => [el % 2 === 0, acc], [], [1, 2, 3, 4])
// returns [[1, 2, 3], [4]]
```

<a name="spread"></a>

## spread()

returns a function that called with an array of values calls the provided function with the spreaded arguments from the array arguments

**Kind**: global function  
**Example**

```js
const func = spread((a, b, c) => a + b + c)
func([1, 2, 3])
// returns 6
```

<a name="sum"></a>

## sum()

returns a sum of all the provided array number values

**Kind**: global function  
**Example**

```js
sum([1, 2, 3])
// returns 6
```

<a name="take"></a>

## take()

returns the specified amount of the provided array elements starting from the beginning

**Kind**: global function  
**Example**

```js
take(2, ['a', 'b', 'c', 'd'])
// returns ['a', 'b']
```

<a name="takeRightWhileFrom"></a>

## takeRightWhileFrom()

takes elements while `predicate` returns true starting from the right from the specified index

**Kind**: global function  
**Example**

```js
takeRightWhileFrom(el => el > 2, 3, [1, 2, 3, 4, 5])
// returns [3, 4]
```

<a name="takeRightWhile"></a>

## takeRightWhile()

takes elements while `predicate` returns true

**Kind**: global function  
**Example**

```js
takeRightWhile(el => el > 2, [1, 2, 3, 4, 5])
// returns [3, 4]
```

<a name="throttle"></a>

## throttle()

ensures that a function is executed at a fixed interval, so that it is not called too frequently

**Kind**: global function  
**Example**

```js
const updatePreview = () => { ... }
const throttledUpdatePreview = throttle(updatePreview, 500);
inputField.addEventListener('input', throttledUpdatePreview);
```

<a name="toArray"></a>

## toArray()

converts values that are iterable to an array

**Kind**: global function  
**Example**

```js
toArray('hello')
// returns ['h', 'e', 'l', 'l', 'o']
```

<a name="toFixedNumber"></a>

## toFixedNumber()

returns the provided number with specified amount of decimal digits

**Kind**: global function  
**Example**

```js
toFixedNumber(1.2345, 2)
// returns 1.23
```

<a name="toPairs"></a>

## toPairs()

returns an array of derived from the provided object key-value tuples

**Kind**: global function  
**Example**

```js
toPairs({ a: 1, b: 2 })
// returns [['a', 1], ['b', 2]]
```

<a name="trailingThrottle"></a>

## trailingThrottle()

ensures that a function is executed at a fixed interval, so that it is not called too frequently

**Kind**: global function  
**Example**

```js
const updatePreview = () => { ... }
const throttledUpdatePreview = trailingThrottle(updatePreview, 500);
inputField.addEventListener('input', throttledUpdatePreview);
```

<a name="leadingThrottle"></a>

## leadingThrottle()

ensures that a function is executed at a fixed interval, so that it is not called too frequently

**Kind**: global function  
**Example**

```js
const updatePreview = () => { ... }
const throttledUpdatePreview = leadingThrottle(updatePreview, 500);
inputField.addEventListener('input', throttledUpdatePreview);
```

<a name="stringCompare"></a>

## stringCompare()

returns 0 for matching strings
return -1 for string with lower char code at some position
return 1 for string with greater char code at some position

**Kind**: global function  
**Example**

```js
stringCompare('abc', 'abc')
// returns 0
stringCompare('abc', 'abd')
// returns -1
```

<a name="trimStart"></a>

## trimStart()

trims the beginning whitespaces from the provided string

**Kind**: global function  
**Example**

```js
trimStart('      hello')
// returns 'hello'
```

<a name="trimEnd"></a>

## trimEnd()

trims the end whitespaces from the provided string

**Kind**: global function  
**Example**

```js
trimEnd('hello     ')
// returns 'hello'
```

<a name="repeat"></a>

## repeat()

returns the provided string repeated the specified amount of times

**Kind**: global function  
**Example**

```js
repeat(3, 'test')
// returns 'testtesttest'
```

<a name="uniqBy"></a>

## uniqBy()

returns an array with all the duplicates from the provided array removed based on the iteratee function

**Kind**: global function  
**Example**

```js
uniqBy(el => el.toString(), [1, '1', 2, '3', 3])
// returns [1, 2, '3']
```

<a name="uniq"></a>

## uniq()

returns an array with all the duplicates from the provided array removed

**Kind**: global function  
**Example**

```js
uniq([1, 1, 2, 3, 3])
// returns [1, 2, 3]
```

<a name="update"></a>

## update()

updates the provided array with the provided value on the specified index

**Kind**: global function  
**Example**

```js
update(2, 3, [1, 2, 5])
// returns [1, 2, 3]
```

<a name="without"></a>

## without()

returns an array without the specified elements from the provided array

**Kind**: global function  
**Example**

```js
without([2, 4], [1, 2, 3, 4, 5])
// returns [1, 3, 5]
```

<a name="zipWith"></a>

## zipWith()

returns an array of tuples of certain index elements from two provided arrays based on the zipper function

**Kind**: global function  
**Example**

```js
zipWith((a, b) => [a * 2, b.toString()], [1, 2, 3], [10, 20, 30])
// returns [[2, '10'], [4, '20'], [6, '30']]
```

<a name="zip"></a>

## zip()

returns an array of tuples of certain index elements from two provided arrays

**Kind**: global function  
**Example**

```js
zip([1, 2, 3], [10, 20, 30])
// returns [[1, 10], [2, 20], [3, 30]]
```