is-regexp-x
Is this value a JS regex?
Version: 2.2.0
module.exports(value)
⇒ boolean
⏏
This method tests if a value is a regex.
Kind: Exported function
Returns: boolean
- true
if value is a regex; otherwise false
.
Param | Type | Description |
---|
value | * | The value to test. |
Example
import isRegex from 'is-regexp-x';
console.log(isRegex(undefined));
console.log(isRegex(null));
console.log(isRegex(false));
console.log(isRegex(true));
console.log(isRegex(42));
console.log(isRegex('foo'));
console.log(isRegex(function () {}));
console.log(isRegex([]));
console.log(isRegex({})));
console.log(isRegex(/a/g));
console.log(isRegex(new RegExp('a', 'g')));