MCPcopy
hub / github.com/lodash/lodash / baseIteratee

Function baseIteratee

lodash.js:3505–3520  ·  view source on GitHub ↗

* The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee.

(value)

Source from the content-addressed store, hash-verified

3503 * @returns {Function} Returns the iteratee.
3504 */
3505 function baseIteratee(value) {
3506 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
3507 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
3508 if (typeof value == 'function') {
3509 return value;
3510 }
3511 if (value == null) {
3512 return identity;
3513 }
3514 if (typeof value == 'object') {
3515 return isArray(value)
3516 ? baseMatchesProperty(value[0], value[1])
3517 : baseMatches(value);
3518 }
3519 return property(value);
3520 }
3521
3522 /**
3523 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.

Callers 1

iterateeFunction · 0.85

Calls 3

baseMatchesPropertyFunction · 0.85
baseMatchesFunction · 0.85
propertyFunction · 0.85

Tested by

no test coverage detected