MCPcopy Create free account
hub / github.com/Lemoncode/fonk / baseGet

Function baseGet

src/helpers/get.js:470–480  ·  view source on GitHub ↗

* The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value.

(object, path)

Source from the content-addressed store, hash-verified

468 * @returns {*} Returns the resolved value.
469 */
470function baseGet(object, path) {
471 path = isKey(path, object) ? [path] : castPath(path);
472
473 let index = 0,
474 length = path.length;
475
476 while (object != null && index < length) {
477 object = object[toKey(path[index++])];
478 }
479 return index && index == length ? object : undefined;
480}
481
482/**
483 * The base implementation of `_.isNative` without bad shim checks.

Callers 1

getFunction · 0.85

Calls 3

isKeyFunction · 0.70
castPathFunction · 0.70
toKeyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…