source: trip-planner-front/node_modules/lodash/_baseIsNative.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1var isFunction = require('./isFunction'),
2 isMasked = require('./_isMasked'),
3 isObject = require('./isObject'),
4 toSource = require('./_toSource');
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
47module.exports = baseIsNative;
Note: See TracBrowser for help on using the repository browser.