MCPcopy
hub / github.com/react/create-react-app / isNative

Function isNative

packages/react-error-overlay/fixtures/bundle_u.mjs:1619–1636  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

1617var warning = __webpack_require__(/*! fbjs/lib/warning */ 1);
1618
1619function isNative(fn) {
1620 // Based on isNative() from Lodash
1621 var funcToString = Function.prototype.toString;
1622 var hasOwnProperty = Object.prototype.hasOwnProperty;
1623 var reIsNative = RegExp('^' + funcToString
1624 // Take an example native function source for comparison
1625 .call(hasOwnProperty)
1626 // Strip regex characters so we can use it for regex
1627 .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
1628 // Remove hasOwnProperty from the template to make it generic
1629 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
1630 try {
1631 var source = funcToString.call(fn);
1632 return reIsNative.test(source);
1633 } catch (err) {
1634 return false;
1635 }
1636}
1637
1638var canUseCollections =
1639// Array.from

Callers 1

bundle_u.mjsFile · 0.70

Calls 1

testMethod · 0.80

Tested by

no test coverage detected