source: imaps-frontend/node_modules/lodash-es/_baseIsNative.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.4 KB
Line 
1import isFunction from './isFunction.js';
2import isMasked from './_isMasked.js';
3import isObject from './isObject.js';
4import toSource from './_toSource.js';
5
6/**
7 * Used to match `RegExp`
8 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
9 */
10var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
11
12/** Used to detect host constructors (Safari). */
13var reIsHostCtor = /^\[object .+?Constructor\]$/;
14
15/** Used for built-in method references. */
16var funcProto = Function.prototype,
17 objectProto = Object.prototype;
18
19/** Used to resolve the decompiled source of functions. */
20var funcToString = funcProto.toString;
21
22/** Used to check objects for own properties. */
23var hasOwnProperty = objectProto.hasOwnProperty;
24
25/** Used to detect if a method is native. */
26var reIsNative = RegExp('^' +
27 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
28 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
29);
30
31/**
32 * The base implementation of `_.isNative` without bad shim checks.
33 *
34 * @private
35 * @param {*} value The value to check.
36 * @returns {boolean} Returns `true` if `value` is a native function,
37 * else `false`.
38 */
39function baseIsNative(value) {
40 if (!isObject(value) || isMasked(value)) {
41 return false;
42 }
43 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
44 return pattern.test(toSource(value));
45}
46
47export default baseIsNative;
Note: See TracBrowser for help on using the repository browser.