No Description

get.js 497B

123456789101112
  1. import toPath from './_toPath.js';
  2. import deepGet from './_deepGet.js';
  3. import isUndefined from './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. export default function get(object, path, defaultValue) {
  9. var value = deepGet(object, toPath(path));
  10. return isUndefined(value) ? defaultValue : value;
  11. }