$ cnpm install is-regexp
Check if a value is a regular expression
$ npm install is-regexp
const isRegexp = require('is-regexp');
isRegexp('unicorn');
//=> false
isRegexp(/unicorn/);
//=> true
isRegexp(new RegExp('unicorn'));
//=> true
MIT © Sindre Sorhus
Copyright 2013 - present © cnpmjs.org