mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Bump to v4.8.0.
This commit is contained in:
17
isNative.js
17
isNative.js
@@ -1,8 +1,12 @@
|
||||
import isFunction from './isFunction';
|
||||
import isHostObject from './_isHostObject';
|
||||
import isObjectLike from './isObjectLike';
|
||||
import isObject from './isObject';
|
||||
import toSource from './_toSource';
|
||||
|
||||
/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
|
||||
/** Used to detect host constructors (Safari). */
|
||||
@@ -42,14 +46,11 @@ var reIsNative = RegExp('^' +
|
||||
* // => false
|
||||
*/
|
||||
function isNative(value) {
|
||||
if (value == null) {
|
||||
if (!isObject(value)) {
|
||||
return false;
|
||||
}
|
||||
if (isFunction(value)) {
|
||||
return reIsNative.test(funcToString.call(value));
|
||||
}
|
||||
return isObjectLike(value) &&
|
||||
(isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
||||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||
return pattern.test(toSource(value));
|
||||
}
|
||||
|
||||
export default isNative;
|
||||
|
||||
Reference in New Issue
Block a user