mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
more work
This commit is contained in:
54
node_modules/lodash/lang/isNative.js
generated
vendored
Normal file
54
node_modules/lodash/lang/isNative.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
var escapeRegExp = require('../string/escapeRegExp'),
|
||||
isObjectLike = require('../internal/isObjectLike');
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var funcTag = '[object Function]';
|
||||
|
||||
/** Used to detect host constructors (Safari > 5). */
|
||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var fnToString = Function.prototype.toString;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
var reIsNative = RegExp('^' +
|
||||
escapeRegExp(objToString)
|
||||
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||
);
|
||||
|
||||
/**
|
||||
* Checks if `value` is a native function.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @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(_);
|
||||
* // => false
|
||||
*/
|
||||
function isNative(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
if (objToString.call(value) == funcTag) {
|
||||
return reIsNative.test(fnToString.call(value));
|
||||
}
|
||||
return isObjectLike(value) && reIsHostCtor.test(value);
|
||||
}
|
||||
|
||||
module.exports = isNative;
|
Reference in New Issue
Block a user