Returns a new factory function that returns can be called to obtain
a copy of defaultObject. Optionally, the factory function can be
passed a partialObject in which case it will return a copy of the
merged object.
Any properties appearing in partialObject must be complete
objects. If you want to update a deeply nested property by
itself, you can do so by directly modifying the object. This is
safe because
This
can still be a bit awkward since there may be a number of optionals
that you have to check before setting the value.
dataFactoryFor(defaultObject)
Returns a new factory function that returns can be called to obtain a copy of
defaultObject
. Optionally, the factory function can be passed apartialObject
in which case it will return a copy of the merged object.Any properties appearing in
partialObject
must be complete objects. If you want to update a deeply nested property by itself, you can do so by directly modifying the object. This is safe becauseThis can still be a bit awkward since there may be a number of optionals that you have to check before setting the value.
Example (shallow override):
Example (deep update):