Initial commit

This commit is contained in:
zhongjin
2020-06-15 10:58:47 +08:00
commit 4f1dfe7564
8590 changed files with 1516878 additions and 0 deletions
@@ -0,0 +1,15 @@
/**
* Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
* @param {Object} object The object to query.
* @param {String} path The path of the property to get.
* @param {Any} defaultValue The value returned for undefined resolved values.
* @return {Any} Returns the resolved value.
*/
module.exports = function (object, path, defaultValue) {
var keys = path.split('.');
var value = keys.reduce(function (a, b) {
return (a || {})[b];
}, object);
return value || defaultValue;
};