Remove toSource.

This commit is contained in:
John-David Dalton
2017-04-08 22:23:09 -07:00
parent 3390d9309b
commit 303502efa7
3 changed files with 7 additions and 40 deletions

View File

@@ -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