No Description

get.js 518B

1234567891011121314
  1. var _toPath = require('./_toPath.js');
  2. var _deepGet = require('./_deepGet.js');
  3. var isUndefined = require('./isUndefined.js');
  4. // Get the value of the (deep) property on `path` from `object`.
  5. // If any property in `path` does not exist or if the value is
  6. // `undefined`, return `defaultValue` instead.
  7. // The `path` is normalized through `_.toPath`.
  8. function get(object, path, defaultValue) {
  9. var value = _deepGet(object, _toPath(path));
  10. return isUndefined(value) ? defaultValue : value;
  11. }
  12. module.exports = get;