chain-able
Version:
interfaces that describe their intentions.
26 lines (24 loc) • 424 B
JavaScript
const isFunction = require('./function')
/**
* @func isMatcher
* @memberOf is
* @since 3.0.0
*
* @param {*} x value to check
* @return {boolean} isFunction || isRegExp
*
* @example
*
* isMatcher(/(.*)/)
* //=> true
*
* isMatcher(x => true)
* //=> true
*
* isMatcher(1)
* //=> false
* isMatcher('.*')
* //=> false
*
*/
module.exports = x => isFunction(x) || x instanceof RegExp