is-regexp
Check whether a variable is a regular expression
Install
$ npm install --save is-regexpUsage
var isRegexp = require('is-regexp');
isRegexp('unicorn');
//=> false
isRegexp(/unicorn/);
//=> true
isRegexp(new RegExp('unicorn'));
//=> trueLicense
MIT © Sindre Sorhus
Last updated
Was this helpful?