expect
Version:
Write better assertions
18 lines (13 loc) • 348 B
JavaScript
import isFunction from './isFunction'
/**
* Returns true if the given object is an instanceof value
* or its typeof is the given value.
*/
function isA(object, value) {
if (isFunction(value))
return object instanceof value
if (value === 'array')
return Array.isArray(object)
return typeof object === value
}
export default isA