assoc()
assoc<
T
>(obj
): <K
>(prop
) => (val
) =>T
Sets the val
of prop
in obj
. Returning a new, shallow copy of the object.
Type Parameters
• T extends object
Parameters
obj
T
The object to set the value on.
Returns
Function
Type Parameters
• K extends string
| number
| symbol
= keyof T
Parameters
prop
K
Returns
Function
Parameters
val
T
[K
]
Returns
T
Example
associate(personStore)('address')({
city: 'Austin',
street: '987 Sample St',
});
// {
// // ...,
// city: 'Austin',
// street: '987 Sample St',
// }