No Description

get.js 501B

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