Apply Defaults - A simple utility to apply default values to any object.
at github.com▼2 up and 1 down, posted by
2 up and 1 down, posted by
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.
You can check for the existence of a property with obj.hasOwnProperty('someProp').