xdash API Reference / toObj
Function: toObj()
toObj<
T
,R
>(arr
,keyFn
,valueFn
):Record
<PropertyKey
,R
>
Defined in: src/typed.ts:95
Converts an array to an object.
Type Parameters
T
T
R
R
= T
Parameters
arr
T
[]
array to fill
keyFn
(item
) => PropertyKey
function to get the key from the item
valueFn
(item
) => R
function to get the value from the item
Returns
Record
<PropertyKey
, R
>
an object with the keys and values from the array