UNPKG

tc39-weakrefs-shim

Version:
36 lines 1.19 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const isObject_js_1 = __importDefault(require("./isObject.js")); /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ const reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect if a method is native. */ const reIsNative = RegExp(`^${Function.prototype.toString.call(Object.prototype.hasOwnProperty) .replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?')}$`); /** * Checks if `value` is a pristine native function. * * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. * @example * * isNative(Array.prototype.push) * // => true * * isNative(isDate) * // => false */ function isNative(value) { return isObject_js_1.default(value) && reIsNative.test(value); } exports.default = isNative; //# sourceMappingURL=isNative.js.map