101
Version:
common javascript utils that can be required selectively that assume es5+
16 lines (12 loc) • 357 B
JavaScript
/**
* @module 101/is-regexp
*/
/**
* Check if a value is an instance of RegExp
* @function module:101/is-regexp
* @param {*} val - value checked to be an instance of RegExp
* @return {boolean} Whether the value is an object or not
*/
module.exports = function isRegExp (val) {
return Object.prototype.toString.call(val) == '[object RegExp]';
};