mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
838 B
36 lines
838 B
9 years ago
|
var isObject = require('./isObject');
|
||
10 years ago
|
|
||
|
/** `Object#toString` result references. */
|
||
|
var regexpTag = '[object RegExp]';
|
||
|
|
||
9 years ago
|
/** Used for built-in method references. */
|
||
10 years ago
|
var objectProto = Object.prototype;
|
||
|
|
||
|
/**
|
||
9 years ago
|
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||
10 years ago
|
* of values.
|
||
|
*/
|
||
9 years ago
|
var objectToString = objectProto.toString;
|
||
10 years ago
|
|
||
|
/**
|
||
|
* Checks if `value` is classified as a `RegExp` object.
|
||
|
*
|
||
|
* @static
|
||
|
* @memberOf _
|
||
|
* @category Lang
|
||
|
* @param {*} value The value to check.
|
||
|
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||
|
* @example
|
||
|
*
|
||
|
* _.isRegExp(/abc/);
|
||
|
* // => true
|
||
|
*
|
||
|
* _.isRegExp('/abc/');
|
||
|
* // => false
|
||
|
*/
|
||
|
function isRegExp(value) {
|
||
9 years ago
|
return isObject(value) && objectToString.call(value) == regexpTag;
|
||
10 years ago
|
}
|
||
|
|
||
|
module.exports = isRegExp;
|