mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Bump to v4.14.0.
This commit is contained in:
25
isRegExp.js
25
isRegExp.js
@@ -1,17 +1,9 @@
|
||||
var isObject = require('./isObject');
|
||||
var baseIsRegExp = require('./_baseIsRegExp'),
|
||||
baseUnary = require('./_baseUnary'),
|
||||
nodeUtil = require('./_nodeUtil');
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var regexpTag = '[object RegExp]';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
/* Node.js helper references. */
|
||||
var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `RegExp` object.
|
||||
@@ -21,8 +13,7 @@ var objectToString = objectProto.toString;
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
||||
* else `false`.
|
||||
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isRegExp(/abc/);
|
||||
@@ -31,8 +22,6 @@ var objectToString = objectProto.toString;
|
||||
* _.isRegExp('/abc/');
|
||||
* // => false
|
||||
*/
|
||||
function isRegExp(value) {
|
||||
return isObject(value) && objectToString.call(value) == regexpTag;
|
||||
}
|
||||
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
|
||||
|
||||
module.exports = isRegExp;
|
||||
|
||||
Reference in New Issue
Block a user