xdash / toObj
Function: toObj()
toObj<
T,R>(arr,keyFn,valueFn):Record<PropertyKey,R>
Converts an array to an object.
Type parameters
• T
• R = T
Parameters
• arr: T[]
array to fill
• keyFn
function to get the key from the item
• valueFn= undefined
function to get the value from the item
Returns
Record<PropertyKey, R>
an object with the keys and values from the array