Functions
- add()
adds two numbers
- hasOwn()
returns true or false depending if the provided property is present inside the provided object
- assign()
assigns properties of one or more source objects onto target object
- capitalizeFirstLetter()
capitalizes first letter of string
- 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
- 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.
- chunk()
chunks provided array to specified size chunks
- isArray()
determines whether provided value is an array
- isObject()
returns true or false depending if the provided value is an object
- keys()
returns an array of the provided object keys
- mapValues()
maps values of the provided object
- cloneDeep()
returns an exact clone of the provided value with a new reference
- camelCase()
converts provided string to camel case
- compact()
removes all nullish and NaN values from the provided object or array
- compose()
returns a composed value from the provided arguments
- debounce()
delays the execution of a function until a certain period of time has passed without the function being called again
- deepMapKeys()
recurses through an object and transforms its keys – and the keys of any nested objects – based on the provided key mapping function
- deepMerge()
deep merges provided objects by assigning the sources onto the target object passed as the first argument
- isNil()
returns true or false depending if the provided value is null or undefined
- defaultTo()
returns a function that invoked with a null or undefined values returns the provided default
- 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
- drop()
drops specific amount of elements of the provided array starting at the beginning
- dropRight()
drops specific amount of elements of the provided array starting at the end
- ensureArray()
returns an array if an array was provided, or a new array if provided value was not an array
- entries()
returns an array of entries of the provided object
- find()
returns the first element of the provided array that returns true for the predicate function, or undefined if the element was not found
- 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
- findKey()
returns the key of the provided object that returns true for the predicate function, or undefined if the key was not found
- findLast()
returns the last element of the provided array that returns true for the predicate function, or undefined if the element was not found
- 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
- 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
- filledArray()
returns an array of requested length filled with provided value
- identity()
returns the provided value
- flatten()
flattens the provided array by one level
- forOwn()
invokes the provided callback for each of the provided object fields
- fromPairs()
returns an object constructed from the provided array of key, value pairs'
- generateRandomId()
generates a random id
- generateUniqueId()
generates an unique id based on the provided object keys
- get()
returns the value from the specififed path from the provided object
- getOr()
returns the value from the specififed path from the provided object or the default value if the path element was not found
- groupBy()
groups values from the provided array or object based on the result of the provided mapper function
- groupKeys()
groups values from the provided object based on the result of the provided key mapping function
- includes()
returns true or false depending if the provided value is present inside the provided array or string
- isEmpty()
returns true or false depending if the provided value is an empty object or an empty array
- isFalsy()
returns true or false depending if the provided value is falsy
- isTruthy()
returns true or false depending if the provided value is truthy
- isPromise()
returns true or false depending if the provided value is a Promise
- keyBy()
constructs an object from the provided array of objects, grouped by the value of the specified key
- last()
returns the last element of the provided array or undefined when array is empty
- mapKeys()
maps keys of the provided object
- mapValuesIndexed()
maps values and keys of the provided object
- merge()
deep merges the two provided objects
- mergeAll()
deep merges all provided objects
- memoizeWith()
memoizes the provided function so it returns cached results but based on the provided key resolver
- memoize()
memoizes the provided function so it returns cached results when invoked with the same arguments
- memoizeOne()
memoizes the provided function so it returns cached results but only with one cache key
- noop()
does literally nothing
- values()
returns an array of values of the provided object
- numericSortBy()
sorts values of the provided object or array based on the provided mapping function or the provided prop string
- omitByIndexed()
returns an object the same as the provided one but without the fields omitted by the predicate function
- omit()
returns the provided object but with specified keys omitted
- omitBy()
returns an object same as the provided one but without the fields omitted by the predicate function
- once()
returns a particular function to be executed only a single time
- over()
returns a function that called invokes the provided array of functions with the call arguments
- takeLast()
returns the specified amount of the provided array elements starting from the end
- overArgs()
returns a function that called invokes the provided arguments transformers
- pair()
returns a tuple from the two provided values
- partitionObject()
returns a tuple of valid and invalid parts of the object as defined in validation function passed in the first argument
- pick()
picks specified properties from the object
- pickBy()
returns an object same as the provided one but with the fields picked by the predicate function
- pickByIndexed()
returns an object same as the provided one but with the fields picked by the predicate function
- pickOwn()
picks specified props only if they exist on the provided object
- randomInt()
returns a random integer number between the specified min and max values
- range()
returns an array filled with numbers in an ascending order to the provided max value
- reject()
returns an array with elements that return false for the provided predicate function
- removeAt()
returns the provided array without the specified index element
- set()
sets the property of the provided object specified by the provided path in form of a string or an array of keys
- shallowEqual()
returns true if the provided values are shallow equal
- shortenLongText()
shortens the provided string by the specified amount
- sign()
returns a sign of the provided number or NaN if value different than number was provided
- shuffle()
returns an array with the provided array values shuffled
- sliceDiff()
returns the diff object from the provided object and slice comparison
- snakeCase()
snake cases the provided string
- someAreTruthy()
returns true if some of the array values is truthy
- splitAt()
splits an array or a string at the given index
- splitRightWhenAccum()
returns a tuple with the provided array splited on an element that returned true for the provided function, iterating from the right side
- spread()
returns a function that called with an array of values calls the provided function with the spreaded arguments from the array arguments
- sum()
returns a sum of all the provided array number values
- take()
returns the specified amount of the provided array elements starting from the beginning
- takeRightWhileFrom()
takes elements while predicate
returns true starting from the right from the specified index
- takeRightWhile()
takes elements while predicate
returns true
- throttle()
ensures that a function is executed at a fixed interval, so that it is not called too frequently
- toArray()
converts values that are iterable to an array
- toFixedNumber()
returns the provided number with specified amount of decimal digits
- toPairs()
returns an array of derived from the provided object key-value tuples
- trailingThrottle()
ensures that a function is executed at a fixed interval, so that it is not called too frequently
- leadingThrottle()
ensures that a function is executed at a fixed interval, so that it is not called too frequently
- 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
- trimStart()
trims the beginning whitespaces from the provided string
- trimEnd()
trims the end whitespaces from the provided string
- repeat()
returns the provided string repeated the specified amount of times
- uniqBy()
returns an array with all the duplicates from the provided array removed based on the iteratee function
- uniq()
returns an array with all the duplicates from the provided array removed
- update()
updates the provided array with the provided value on the specified index
- without()
returns an array without the specified elements from the provided array
- zipWith()
returns an array of tuples of certain index elements from two provided arrays based on the zipper function
- zip()
returns an array of tuples of certain index elements from two provided arrays
add()
adds two numbers
Kind: global function
Example
add(1, 2)
hasOwn()
returns true or false depending if the provided property is present inside the provided object
Kind: global function
Example
hasOwn('a', { a: 1, b: 2 })
assign()
assigns properties of one or more source objects onto target object
Kind: global function
Example
assign({ a: 1, b: 2 }, { b: 4, c: 5 })
capitalizeFirstLetter()
capitalizes first letter of string
Kind: global function
Example
capitalizeFirstLetter('hello')
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
const arr = [{ a: [1, 2] }, { a: [3, 4] }, { a: [5, 6] }]
flatMap(el => el.a, arr)
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
chain(n => [n, n], [1, 2, 3])
const head = list => list[0]
const append = el => list => list.concat(el)
chain(append, head)([1, 2, 3])
chunk()
chunks provided array to specified size chunks
Kind: global function
Example
chunk([1, 2, 3, 4], 2)
isArray()
determines whether provided value is an array
Kind: global function
Example
isArray([1, 2])
isArray('hello')
isObject()
returns true or false depending if the provided value is an object
Kind: global function
Example
isObject({ a: 1 })
isObject([1, 2])
keys()
returns an array of the provided object keys
Kind: global function
Example
keys({ a: 1, b: 2, c: 3 })
mapValues()
maps values of the provided object
Kind: global function
Example
mapValues(val => val.toUpperCase(), { a: 'foo', b: 'bar' })
cloneDeep()
returns an exact clone of the provided value with a new reference
Kind: global function
Example
cloneDeep({ a: 1, b: 2 })
camelCase()
converts provided string to camel case
Kind: global function
Example
camelCase('hello_world')
compact()
removes all nullish and NaN values from the provided object or array
Kind: global function
Example
compact({ a: 1, b: null })
compact(['hello', undefined])
compose()
returns a composed value from the provided arguments
Kind: global function
Example
const f3 = (a: string) => `f3(${a})`
const f2 = (a: string) => `f2(${a})`
const f1 = (a: string) => `f1(${a})`
compose(f3, f2, f1)('arg')
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
debounce(1000, someFunction)
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
deepMapKeys(key => `test_${key}`, { a: 1, b: { c: 2 } })
deepMerge()
deep merges provided objects by assigning the sources onto the target object passed as the first argument
Kind: global function
Example
deepMerge({ a: 1, b: { c: 2 } }, { b: { d: 3 } })
isNil()
returns true or false depending if the provided value is null or undefined
Kind: global function
Example
isNil(null)
defaultTo()
returns a function that invoked with a null or undefined values returns the provided default
Kind: global function
Example
const defaulter = defaultTo('default')
defaulter('hello')
defaulter(null)
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
diffKeys({ a: 1, b: 2, c: 3 }, { c: 3, d: 4 })
drop()
drops specific amount of elements of the provided array starting at the beginning
Kind: global function
Example
drop(2, [1, 2, 3, 4])
dropRight()
drops specific amount of elements of the provided array starting at the end
Kind: global function
Example
dropRight(2, [1, 2, 3, 4])
ensureArray()
returns an array if an array was provided, or a new array if provided value was not an array
Kind: global function
Example
ensureArray([1, 2])
ensureArray('test')
entries()
returns an array of entries of the provided object
Kind: global function
Example
entries({ a: 1, b: 2 })
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
find(el => el === 2, [1, 2, 3])
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
findIndex(el => el === 2, [1, 2, 3])
findIndex(el => el === 5, [1, 2, 3])
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
findKey(el => el === 1, { a: 1, b: { c: 2 } })
findKey(el => el === 2, { a: 1, b: { c: 2 } })
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
findLast(el => el % 2 === 0, [1, 2, 3, 4])
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
findLastIndexFrom(el => el % 2 === 0, 3, [1, 2, 3, 4, 5, 6])
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
findLastIndex(el => el % 2 === 0, [1, 2, 3, 4])
filledArray()
returns an array of requested length filled with provided value
Kind: global function
Example
filledArray(3, 1)
identity()
returns the provided value
Kind: global function
Example
identity('hello')
flatten()
flattens the provided array by one level
Kind: global function
Example
flatten([1, 2, [3, 4]])
flatten([1, 2, [3, [4, 5]], 6])
forOwn()
invokes the provided callback for each of the provided object fields
Kind: global function
Example
const obj = { a: 1, b: 2, c: 3 }
const arr: string[] = []
forOwn(el => arr.push(el.toString()), obj)
fromPairs()
returns an object constructed from the provided array of key, value pairs'
Kind: global function
Example
const arr = [
['a', 1],
['b', 2],
['c', 3],
]
fromPairs(arr)
generateRandomId()
generates a random id
Kind: global function
Example
generateRandomId()
generateUniqueId()
generates an unique id based on the provided object keys
Kind: global function
Example
generateUniqueId({ xuvarw8cao: 1, b837g2nba1d: 2 })
get()
returns the value from the specififed path from the provided object
Kind: global function
Example
const obj = { a: { b: [1, 2, 3] } }
get('a.b.1', obj)
get(['a', 'b', '1'], obj)
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
const obj = { a: { b: [1, 2, 3] } }
getOr(null, 'a.b.1', obj)
getOr(null, 'a.c', obj)
groupBy()
groups values from the provided array or object based on the result of the provided mapper function
Kind: global function
Example
const arr = [
{ a: 1, b: 2 },
{ a: 2, b: 4 },
{ a: 3, b: 6 },
]
groupBy(el => (el.a % 2 === 0 ? 'even' : 'odd'), arr)
groupKeys()
groups values from the provided object based on the result of the provided key mapping function
Kind: global function
Example
const obj = { a: 1, b: 2, c: 3 }
groupKeys(el => (el === 'a' ? 'aaa' : 'rest'), obj)
includes()
returns true or false depending if the provided value is present inside the provided array or string
Kind: global function
Example
includes('a', ['a', 'b', 'c'])
includes('d', 'abc')
isEmpty()
returns true or false depending if the provided value is an empty object or an empty array
Kind: global function
Example
isEmpty({})
isFalsy()
returns true or false depending if the provided value is falsy
Kind: global function
Example
isFalsy(0)
isTruthy()
returns true or false depending if the provided value is truthy
Kind: global function
Example
isTruthy(1)
isPromise()
returns true or false depending if the provided value is a Promise
Kind: global function
Example
isPromise(new Promise(res => res(null)))
keyBy()
constructs an object from the provided array of objects, grouped by the value of the specified key
Kind: global function
Example
const arr = [
{ a: 'foo', b: 'bar' },
{ a: 'foo', b: 'baz' },
{ a: 'test', b: 'bab' },
]
keyBy('a', arr)
last()
returns the last element of the provided array or undefined when array is empty
Kind: global function
Example
last([1, 2, 3])
mapKeys()
maps keys of the provided object
Kind: global function
Example
mapKeys(key => key.toUpperCase(), { a: 1, b: 2 })
mapValuesIndexed()
maps values and keys of the provided object
Kind: global function
Example
mapValuesIndexed((val, key) => `${key}-${val}`, { a: 1, b: 2 })
merge()
deep merges the two provided objects
Kind: global function
Example
merge({ a: 1 }, { b: 2 })
mergeAll()
deep merges all provided objects
Kind: global function
Example
mergeAll({ a: 1 }, { b: 2 }, { c: 3 })
memoizeWith()
memoizes the provided function so it returns cached results but based on the provided key resolver
Kind: global function
Example
const memoizedFunc = memoizeWith(
key => (key === 'a' ? key : 'bar'),
(val: string) => ({ current: val }),
)
memoizedFunc('a') === memoizedFunc('a')
memoizedFunc('b') === memoizedFunc('c')
memoize()
memoizes the provided function so it returns cached results when invoked with the same arguments
Kind: global function
Example
const memoizedFunc = memoize((val: number) => ({ current: val })
memoizedFunc(3) === memoizedFunc(3)
memoizeOne()
memoizes the provided function so it returns cached results but only with one cache key
Kind: global function
Example
const memoizedFunc = memoizeOne((val: number) => ({ current: val })
const resultFor1 = memoizedFunc(1)
resultFor1 === memoizedFunc(1)
resultFor1 === memoizedFunc(1)
const resultFor2 = memoizedFunc(2)
resultFor2 === memoizedFunc(2)
resultFor1 === memoizedFunc(1)
noop()
does literally nothing
Kind: global function
Example
somethingAsyncAndDangerous().catch(noop)
values()
returns an array of values of the provided object
Kind: global function
Example
values({ a: 1, b: 2, c: 3 })
numericSortBy()
sorts values of the provided object or array based on the provided mapping function or the provided prop string
Kind: global function
Example
const obj = {
a: { chats: 1 },
b: { chats: 3 },
c: { chats: 2 },
}
numericSortBy(el => el.chats * -1, obj)
omitByIndexed()
returns an object the same as the provided one but without the fields omitted by the predicate function
Kind: global function
Example
omitByIndexed((val, key) => key === 'b', { a: 1, b: 2, c: 3 })
omit()
returns the provided object but with specified keys omitted
Kind: global function
Example
omit(['a'], { a: 1, b: 2 })
omitBy()
returns an object same as the provided one but without the fields omitted by the predicate function
Kind: global function
Example
omitBy(el => el % 2 === 0, { a: 1, b: 2, c: 3 })
once()
returns a particular function to be executed only a single time
Kind: global function
Example
const results = [1, 2, 3, 4, 5]
const getResult = once(() => results.pop())
getResult()
getResult()
getResult()
over()
returns a function that called invokes the provided array of functions with the call arguments
Kind: global function
Example
const func = over([val => val + 1, val => val * 10, Boolean])
func(1)
takeLast()
returns the specified amount of the provided array elements starting from the end
Kind: global function
Example
takeLast(2, ['a', 'b', 'c', 'd'])
overArgs()
returns a function that called invokes the provided arguments transformers
Kind: global function
Example
const func = overArgs((a, b, c) => [a, b, c], [n => n * n, Boolean])
func(2, 0, 1)
pair()
returns a tuple from the two provided values
Kind: global function
Example
pair('a', 'b')
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
partitionObject(el => el % 2 === 0, { a: 1, b: 2, c: 3 })
pick()
picks specified properties from the object
Kind: global function
Example
pick(['b'], { a: 1, b: 2 })
pickBy()
returns an object same as the provided one but with the fields picked by the predicate function
Kind: global function
Example
pickBy(el => el % 2 === 0, { a: 1, b: 2, c: 3 })
pickByIndexed()
returns an object same as the provided one but with the fields picked by the predicate function
Kind: global function
Example
pickByIndexed((val, key) => key === 'b', { a: 1, b: 2, c: 3 })
pickOwn()
picks specified props only if they exist on the provided object
Kind: global function
Example
pickOwn(['b'], { a: 1, b: 2 })
randomInt()
returns a random integer number between the specified min and max values
Kind: global function
Example
randomInt(0, 10)
range()
returns an array filled with numbers in an ascending order to the provided max value
Kind: global function
Example
range(5)
reject()
returns an array with elements that return false for the provided predicate function
Kind: global function
Example
reject(el => el % 2 === 0, [1, 2, 3, 4, 5])
removeAt()
returns the provided array without the specified index element
Kind: global function
Example
removeAt(2, [1, 2, 3, 4, 5])
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
const obj = { a: 1, b: { c: 2 } }
set('b.d', 3, obj)
set(['b', 'd'], 3, obj)
shallowEqual()
returns true if the provided values are shallow equal
Kind: global function
Example
shallowEqual({ a: 1 }, { a: 1 })
shallowEqual({ a: { b: 1 } }, { a: { b: 1 } })
shortenLongText()
shortens the provided string by the specified amount
Kind: global function
Example
shortenLongText(5, 'Lorem ipsum dolor')
sign()
returns a sign of the provided number or NaN if value different than number was provided
Kind: global function
Example
sign(10)
sign(-8)
shuffle()
returns an array with the provided array values shuffled
Kind: global function
Example
shuffle([1, 2, 3, 4])
sliceDiff()
returns the diff object from the provided object and slice comparison
Kind: global function
Example
sliceDiff({ a: 1, b: 10, g: 3 }, { a: 1, b: 2, c: 3 })
snakeCase()
snake cases the provided string
Kind: global function
Example
snakeCase('helloWorld')
someAreTruthy()
returns true if some of the array values is truthy
Kind: global function
Example
someAreTruthy([0, 1, 2])
splitAt()
splits an array or a string at the given index
Kind: global function
Example
splitAt(2, [1, 2, 3, 4, 5])
splitAt(2, 'foobar')
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
splitRightWhenAccum((el, acc) => [el % 2 === 0, acc], [], [1, 2, 3, 4])
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
const func = spread((a, b, c) => a + b + c)
func([1, 2, 3])
sum()
returns a sum of all the provided array number values
Kind: global function
Example
sum([1, 2, 3])
take()
returns the specified amount of the provided array elements starting from the beginning
Kind: global function
Example
take(2, ['a', 'b', 'c', 'd'])
takeRightWhileFrom()
takes elements while predicate
returns true starting from the right from the specified index
Kind: global function
Example
takeRightWhileFrom(el => el > 2, 3, [1, 2, 3, 4, 5])
takeRightWhile()
takes elements while predicate
returns true
Kind: global function
Example
takeRightWhile(el => el > 2, [1, 2, 3, 4, 5])
throttle()
ensures that a function is executed at a fixed interval, so that it is not called too frequently
Kind: global function
Example
const updatePreview = () => { ... }
const throttledUpdatePreview = throttle(updatePreview, 500);
inputField.addEventListener('input', throttledUpdatePreview);
toArray()
converts values that are iterable to an array
Kind: global function
Example
toArray('hello')
toFixedNumber()
returns the provided number with specified amount of decimal digits
Kind: global function
Example
toFixedNumber(1.2345, 2)
toPairs()
returns an array of derived from the provided object key-value tuples
Kind: global function
Example
toPairs({ a: 1, b: 2 })
trailingThrottle()
ensures that a function is executed at a fixed interval, so that it is not called too frequently
Kind: global function
Example
const updatePreview = () => { ... }
const throttledUpdatePreview = trailingThrottle(updatePreview, 500);
inputField.addEventListener('input', throttledUpdatePreview);
leadingThrottle()
ensures that a function is executed at a fixed interval, so that it is not called too frequently
Kind: global function
Example
const updatePreview = () => { ... }
const throttledUpdatePreview = leadingThrottle(updatePreview, 500);
inputField.addEventListener('input', throttledUpdatePreview);
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
stringCompare('abc', 'abc')
stringCompare('abc', 'abd')
trimStart()
trims the beginning whitespaces from the provided string
Kind: global function
Example
trimStart(' hello')
trimEnd()
trims the end whitespaces from the provided string
Kind: global function
Example
trimEnd('hello ')
repeat()
returns the provided string repeated the specified amount of times
Kind: global function
Example
repeat(3, 'test')
uniqBy()
returns an array with all the duplicates from the provided array removed based on the iteratee function
Kind: global function
Example
uniqBy(el => el.toString(), [1, '1', 2, '3', 3])
uniq()
returns an array with all the duplicates from the provided array removed
Kind: global function
Example
uniq([1, 1, 2, 3, 3])
update()
updates the provided array with the provided value on the specified index
Kind: global function
Example
update(2, 3, [1, 2, 5])
without()
returns an array without the specified elements from the provided array
Kind: global function
Example
without([2, 4], [1, 2, 3, 4, 5])
zipWith()
returns an array of tuples of certain index elements from two provided arrays based on the zipper function
Kind: global function
Example
zipWith((a, b) => [a * 2, b.toString()], [1, 2, 3], [10, 20, 30])
zip()
returns an array of tuples of certain index elements from two provided arrays
Kind: global function
Example
zip([1, 2, 3], [10, 20, 30])