|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
777 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const functionToString = Function.prototype.toString;
|
|---|
| 6 | const REGEXP_SYNTAX_CHARS = /[\\^$.*+?()[\]{}|]/g;
|
|---|
| 7 | const IS_NATIVE_FUNCTION_REGEXP = RegExp(`^${functionToString
|
|---|
| 8 | .call(Object.prototype.hasOwnProperty)
|
|---|
| 9 | .replace(REGEXP_SYNTAX_CHARS, '\\$&')
|
|---|
| 10 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?')}$`);
|
|---|
| 11 | function isNative(value) {
|
|---|
| 12 | if (typeof value !== 'function') {
|
|---|
| 13 | return false;
|
|---|
| 14 | }
|
|---|
| 15 | if (globalThis?.['__core-js_shared__'] != null) {
|
|---|
| 16 | throw new Error('Unsupported core-js use. Try https://npms.io/search?q=ponyfill.');
|
|---|
| 17 | }
|
|---|
| 18 | return IS_NATIVE_FUNCTION_REGEXP.test(functionToString.call(value));
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | exports.isNative = isNative;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.