Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

_baseGet.js 616B

123456789101112131415161718192021222324
  1. var castPath = require('./_castPath'),
  2. toKey = require('./_toKey');
  3. /**
  4. * The base implementation of `_.get` without support for default values.
  5. *
  6. * @private
  7. * @param {Object} object The object to query.
  8. * @param {Array|string} path The path of the property to get.
  9. * @returns {*} Returns the resolved value.
  10. */
  11. function baseGet(object, path) {
  12. path = castPath(path, object);
  13. var index = 0,
  14. length = path.length;
  15. while (object != null && index < length) {
  16. object = object[toKey(path[index++])];
  17. }
  18. return (index && index == length) ? object : undefined;
  19. }
  20. module.exports = baseGet;