Closed nosuchip closed 5 years ago
In most cases with simple objects that are not nested, Object.assign
would be sufficient. Though Object.assign
isn't great at deep cloning on its own.
https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript
The goal of using hoek
was to err on the side of safety. In the rare case a more complicated object was passed, we wouldn't want unexpected child nodes to be used by reference, possibly causing hard to debug errors.
Hoek docs: https://github.com/hapijs/hoek/blob/master/API.md#applytodefaultsdefaults-source-options
I see, thanks.
First of all thank you for
mongo-models
package, I like it how it slim and thin. I checked its code and found that it is actually don't needhoek
dependency as onlyapplyToDefauls
used that can be easily replaced byObject.assign(...)
. Do you mind if I prepare PR that allows to reduce dependencies count by one?