source: node_modules/es-toolkit/dist/compat/predicate/isNative.js@ ba17441

Last change on this file since ba17441 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
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const functionToString = Function.prototype.toString;
6const REGEXP_SYNTAX_CHARS = /[\\^$.*+?()[\]{}|]/g;
7const IS_NATIVE_FUNCTION_REGEXP = RegExp(`^${functionToString
8 .call(Object.prototype.hasOwnProperty)
9 .replace(REGEXP_SYNTAX_CHARS, '\\$&')
10 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?')}$`);
11function 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
21exports.isNative = isNative;
Note: See TracBrowser for help on using the repository browser.