toPlainObject
This function converts an iterable object or a plain object to new a plain object
((Iterable | Object))
an iterable object or a plain object
(function?)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be used as context(this) when executed callback function
Object
:
New plain object
toPlainObject([1, 2, 3]) // {0: 1, 1: 2, 2: 3}
toMap
This function converts an iterable object or a plain object to new a map object
((Iterable | Object))
An iterable object or a plain object
(function?)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
Map<string, any>
:
New map object
toMap([1, 2, 3]) // Map(3){"x" => 1, "y" => 2, "z" => 3}
toSet
This function converts an iterable object or a plain object to new a set object
((Iterable | Object))
An iterable object or a plain object
(function?)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
Set<any>
:
New set object
toSet({ x: 1, y: 2, z: 3 }) // Set(3){{ ... }, { ... }, { ... }
toSetAll
This function converts an any value to new a set object
(any)
An any value
(function?)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
Array<any>
:
New set object
toSetAll(undefined) // Set { undefined }
toArray
This function converts an iterable object or a plain object to new an array object
((Iterable | Object))
An iterable object or a plain object
(function?)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
Array
:
toArray({ x: 1, y: 2, z: 3 }); // [{ k: 'x', v: 1 }, { k: 'y', v: 2 }, { k: 'z', v: 3 }]
toArrayAll
This function converts an any value to new an array object
(any)
An any value
(function?)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
Array
:
toArrayAll(undefined) // [undefined]
assign
This function assigns several source objects to a target object
((Iterable | Object))
target object which will be assigned
(Object)
Source objects which to assign to a target object
Object
:
New target object
assign([1, 2, 3], 33, 33, 44) // [ 1, 2, 3, 33, 33, 44 ]
entries
This function returns new array object with [key, value] pair
((Iterable | Object))
An iterable object or a plain object
Array
:
New array object
entries({ x: 1, y: 2, z: new Map([['x', 1]]) }) // [['x', 1], ['y', 2], ['z', Map { 'x' => 1 }]]
copy
This function returns new value which shallow copied of given value
(any)
Value which will be copy
(any?)
Context(this) which will be bind if function type
any
:
Copied value
copy(new Map([['x', 1], ['y', 2]])) // Map { 'x' => 1, 'y' => 2 }
deepCopy
This function returns new value which deep copied of given value
(any)
Value which will be copy
(function?)
Function which will be call on every element of given value
(any?)
Value which will be used as context(this) when executed callback function
any
:
Copied value
deepCopy({ x: { y: new Map([['x', { x: { y: function() {}, z: new Set([1, 2, 3]) } }]]) } }) // { x: { y: Map { 'x' => [Object] } } }
deepFreeze
This function will be deeply freeze of given object
(any)
Value which will be frozen
any
:
deepFreeze({ x: { y: { z: () => {} } } })
deepSeal
This function will be deeply seal of given object
((Iterable | Object))
Iterable object or Plain object
Object
:
deepSeal({ x: { y: { z: () => {} } } })
deepPreventExtensions
This function will be prevent extended of given object
((Iterable | Object))
Iterable object or Plain object
Object
:
deepPreventExtensions({ x: { y: { z: () => {} } } })
hasProp
This function returns whether has a property in given object
boolean
:
hasProp({ x: { y: { z: () => {} } } }, 'x') // true
deepHasProp
This function returns whether has a property in given object
boolean
:
deepHasProp({ x: { y: { z: () => {}, x: { y: { zz: 1 } } } } }, 'zz') // true
deepHasExtensible
This function returns whether has extensible of given object
((Iterable | Object))
Iterable object or Plain object
boolean
:
deepHasExtensible(obj)
deepHasFrozen
This function returns whether has freeze of given object
((Iterable | Object))
Iterable object or Plain object
boolean
:
deepHasFrozen(obj)
deepHasSealed
This function returns whether seal of given object
((Iterable | Object))
Iterable object or Plain object
boolean
:
deepHasSealed(obj)
hasInstanceOf
This function returns whether included a constructor in prototype object
boolean
:
hasInstanceOf(obj, constructor) // true
insert
This function inserts a value from a target index of an array object or a set object
(number)
Target index
(any)
Values which will be inserted
(Set | Array)
:
insert([1, 2, 3, 4], 1, 22) // [1, 22, 2, 3, 4]
replace
This function replaces from target index value of an array object or a set object to new values
(number)
Target index
(any)
Values which will be replaced
(Set | Array)
:
replace([1, 2, 3, 4], 2, 33, 'ADD') // [1, 2, 33, 'ADD', 4]
unshift
This function inserts a value from first index of an iterable object or a plain object
(Set | Array)
:
unshift([1, 2, 3], 11, 22, 33) // [ 11, 22, 33, 1, 2, 3 ]
push
This function inserts a value from last index of an iterable object or a plain object
(Set | Array)
:
push([1, 2, 3], 11, 22, 33) // [ 1, 2, 3, 11, 22, 33 ]
remove
This function removes a value at a target index of an array object or a set object
(function)
Function which will be call on every element of an iterable object or a plain object
(number
= 0
)
Start index which will be search
(Set | Array)
:
remove(['1', 2, 3, 4], v => typeof v === 'number'); // ['1']
size
This function returns a length of an iterable object or plain object
((Iterable | Object))
An iterable object or a plain object
number
:
size(new Map([['x', 1]])) // 1
forEach
This function will be call every element of an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
(function)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
forEach('test', (v, k) => console.log(v)); // 't', 'e', 's', 't'
of
This function returns new an array object which includes an every arguments
(any)
Values which will be included
Array
:
of(1, 2, 3, 4); // [1, 2, 3, 4]
indexOf
This function returns index of found value from an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
(function)
Function which will be call on every element of an iterable object or a plain object
(number
= 0
)
Start index which will be search
number
:
indexOf([1, 2, 3], v => v === 2); // 1
lastIndexOf
This function returns index of found value from an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
(function)
Function which will be call on every element of an iterable object or a plain object
(number
= Iterable.length-1
)
Start index which will be search from last index
number
:
lastIndexOf([1, 2, 3], v => v === 3); // 2
join
This function returns joined value as a separator from every elements of an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
(any)
separate value
string
:
join({ x: 1, y: 2, z: 3 }, '-') // '1-2-3'
keys
This function returns index of found value from an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
Array
:
keys([1, , 3]) // [0, 1, 2]
values
This function returns index of found value from an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
Array
:
values({ x: 1, y: 2, z: 3 }) // [1, 2, 3]
find
This function returns a first element found from an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
(function)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
any
:
find(['1', 2, 3], v => typeof v === 'number') // 2
findIndex
This function returns an index of first element found from an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
(function)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
number
:
findIndex(['1', 2, 3], v => typeof v === 'number') // 1
deepFind
This function returns a first element found from an iterable object or a plain object
((Iterable | Object))
An iterable object or a plain object
(function)
Function which will be call on every element of an iterable object or a plain object
(any?)
Value which will be use as context(this) when executed callback function
Object
:
deepFind([{ x: { xx: { y: 3, z: 'A' } } }], v => typeof v === 'number') // { c: { y: 3, z: 'A' }, k: 'y', v: 3, origin: [{ ... }] }
includes
This function returns whether in an array includes certain value and is not
((Iterable | Object))
An iterable object or a plain object
(function)
Target Value which will be search
(number?)
Start index which to searching
boolean
:
includes([1, 2, 3], v => v === 2) // true
asc
This function returns new array object sorted to ascending
((Iterable | Object))
An iterable object or a plain object
Array
:
asc({ x: 'd', y: null, z: 0xff }) // [null, 'd', 255]
desc
This function returns new array object sorted to descending
((Iterable | Object))
An iterable object or a plain object
Array
:
desc(['d', true, undefined, 0xff, 'ee', [], 2e4, () => {}, 't', 0]) // [20000, 255, 'ee', 't', 'd', true, Array(0), f (), 0, undefined]
ascBy
This function returns new array object sorted ascending by object key
Array
:
ascBy([{ x: 1, y: 11 }, { x: 2, y: 22 }, { x: 3, y: 33 }], 'y') // [{ ...y: 11 }, { ...y: 22 }, { ...y: 33 }]
descBy
This function returns new array object sorted descending by object key
Array
:
descBy([{ x: 1, y: 11 }, { x: 2, y: 22 }, { x: 3, y: 33 }], 'y') // [{ ...y: 33 }, { ...y: 22 }, { ...y: 11 }]