mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Remove toSource.
This commit is contained in:
11
isNative.js
11
isNative.js
@@ -1,6 +1,4 @@
|
||||
import isFunction from './isFunction.js'
|
||||
import isObject from './isObject.js'
|
||||
import toSource from './.internal/toSource.js'
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
@@ -8,9 +6,6 @@ import toSource from './.internal/toSource.js'
|
||||
*/
|
||||
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g
|
||||
|
||||
/** Used to detect host constructors (Safari). */
|
||||
const reIsHostCtor = /^\[object .+?Constructor\]$/
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
const reIsNative = RegExp(`^${
|
||||
Function.prototype.toString.call(Object.prototype.hasOwnProperty)
|
||||
@@ -35,11 +30,7 @@ const reIsNative = RegExp(`^${
|
||||
* // => false
|
||||
*/
|
||||
function isNative(value) {
|
||||
if (!isObject(value)) {
|
||||
return false
|
||||
}
|
||||
const pattern = isFunction(value) ? reIsNative : reIsHostCtor
|
||||
return pattern.test(toSource(value))
|
||||
return isObject(value) && reIsNative.test(value)
|
||||
}
|
||||
|
||||
export default isNative
|
||||
|
||||
Reference in New Issue
Block a user