Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.