mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Add getValue helper.
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -1006,6 +1006,18 @@
|
|||||||
return '\\' + stringEscapes[chr];
|
return '\\' + stringEscapes[chr];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value at `key` of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @param {string} key The key of the property to get.
|
||||||
|
* @returns {*} Returns the property value.
|
||||||
|
*/
|
||||||
|
function getValue(object, key) {
|
||||||
|
return object[key];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the index at which the first occurrence of `NaN` is found in `array`.
|
* Gets the index at which the first occurrence of `NaN` is found in `array`.
|
||||||
*
|
*
|
||||||
@@ -5393,7 +5405,7 @@
|
|||||||
* @returns {*} Returns the function if it's native, else `undefined`.
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
||||||
*/
|
*/
|
||||||
function getNative(object, key) {
|
function getNative(object, key) {
|
||||||
var value = object[key];
|
var value = getValue(object, key);
|
||||||
return (isMaskable(value) ? baseIsNative : isNative)(value) ? value : undefined;
|
return (isMaskable(value) ? baseIsNative : isNative)(value) ? value : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user