The Wayback Machine - https://web.archive.org/web/20170626180658/https://github.com/lodash/lodash/blob/master/isRegExp.js
Skip to content
Permalink
41a8d22 Mar 7, 2017
@jdalton @falsyvalues
28 lines (24 sloc) 700 Bytes
import baseGetTag from './.internal/baseGetTag.js'
import isObjectLike from './isObjectLike.js'
import nodeUtil from './.internal/nodeUtil.js'
/* Node.js helper references. */
const nodeIsRegExp = nodeUtil && nodeUtil.isRegExp
/**
* Checks if `value` is classified as a `RegExp` object.
*
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
* @example
*
* isRegExp(/abc/)
* // => true
*
* isRegExp('/abc/')
* // => false
*/
const isRegExp = nodeIsRegExp
? (value) => nodeIsRegExp(value)
: (value) => isObjectLike(value) && baseGetTag(value) == '[object RegExp]'
export default isRegExp
You can't perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.