Echo JS 0.11.0

<~>
jth0024 2549 days ago. link parent 1 point
Good question! I assumed that most people using this library would use it to handle missing arguments in their functions. Based on that common use-case, I expect that null and Undefined are both considered "missing" arguments. That being said, I anticipated that this might not work for every use-case, so I allow you to write your own customizer if that behavior is not ideal.

Replies

xat 2549 days ago. link 1 point
You can check for the existence of a property with obj.hasOwnProperty('someProp').
jth0024 2549 days ago. link 1 point
Yep, you can. But like I said, if I were only hoping to apply default values for missing properties I would just use Object.assign like others have suggested. Instead, I wanted the ability to use any conditional check that I choose when merging values, and I wrote this library because I've frequently needed to write little wrappers that used Object.assign to do that. It's useful to me because it provides an easy way to perform common tasks with less code. I didn't write the library because I'm unfamiliar with ES2015 or the Object API.