1 |
3a515b92
|
cagy
|
var baseIsNative = require('./_baseIsNative'),
|
2 |
|
|
isMaskable = require('./_isMaskable');
|
3 |
|
|
|
4 |
|
|
/** Error message constants. */
|
5 |
|
|
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.';
|
6 |
|
|
|
7 |
|
|
/**
|
8 |
|
|
* Checks if `value` is a pristine native function.
|
9 |
|
|
*
|
10 |
|
|
* **Note:** This method can't reliably detect native functions in the presence
|
11 |
|
|
* of the core-js package because core-js circumvents this kind of detection.
|
12 |
|
|
* Despite multiple requests, the core-js maintainer has made it clear: any
|
13 |
|
|
* attempt to fix the detection will be obstructed. As a result, we're left
|
14 |
|
|
* with little choice but to throw an error. Unfortunately, this also affects
|
15 |
|
|
* packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
|
16 |
|
|
* which rely on core-js.
|
17 |
|
|
*
|
18 |
|
|
* @static
|
19 |
|
|
* @memberOf _
|
20 |
|
|
* @since 3.0.0
|
21 |
|
|
* @category Lang
|
22 |
|
|
* @param {*} value The value to check.
|
23 |
|
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
24 |
|
|
* else `false`.
|
25 |
|
|
* @example
|
26 |
|
|
*
|
27 |
|
|
* _.isNative(Array.prototype.push);
|
28 |
|
|
* // => true
|
29 |
|
|
*
|
30 |
|
|
* _.isNative(_);
|
31 |
|
|
* // => false
|
32 |
|
|
*/
|
33 |
|
|
function isNative(value) {
|
34 |
|
|
if (isMaskable(value)) {
|
35 |
|
|
throw new Error(CORE_ERROR_TEXT);
|
36 |
|
|
}
|
37 |
|
|
return baseIsNative(value);
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
module.exports = isNative;
|