mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Remove semicolons.
This commit is contained in:
24
isNative.js
24
isNative.js
@@ -1,22 +1,22 @@
|
||||
import isFunction from './isFunction.js';
|
||||
import isObject from './isObject.js';
|
||||
import toSource from './.internal/toSource.js';
|
||||
import isFunction from './isFunction.js'
|
||||
import isObject from './isObject.js'
|
||||
import toSource from './.internal/toSource.js'
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||||
*/
|
||||
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g
|
||||
|
||||
/** Used to detect host constructors (Safari). */
|
||||
const reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
const reIsHostCtor = /^\[object .+?Constructor\]$/
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
const reIsNative = RegExp(`^${
|
||||
Function.prototype.toString.call(Object.prototype.hasOwnProperty)
|
||||
.replace(reRegExpChar, '\\$&')
|
||||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?')
|
||||
}$`);
|
||||
}$`)
|
||||
|
||||
/**
|
||||
* Checks if `value` is a pristine native function.
|
||||
@@ -28,18 +28,18 @@ const reIsNative = RegExp(`^${
|
||||
* else `false`.
|
||||
* @example
|
||||
*
|
||||
* isNative(Array.prototype.push);
|
||||
* isNative(Array.prototype.push)
|
||||
* // => true
|
||||
*
|
||||
* isNative(isDate);
|
||||
* isNative(isDate)
|
||||
* // => false
|
||||
*/
|
||||
function isNative(value) {
|
||||
if (!isObject(value)) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
const pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
||||
return pattern.test(toSource(value));
|
||||
const pattern = isFunction(value) ? reIsNative : reIsHostCtor
|
||||
return pattern.test(toSource(value))
|
||||
}
|
||||
|
||||
export default isNative;
|
||||
export default isNative
|
||||
|
||||
Reference in New Issue
Block a user