UNPKG

testdouble

Version:

A minimal test double library for TDD with JavaScript

16 lines (13 loc) 328 B
import _ from '../../wrap/lodash' import isGenerator from '../is-generator' export default (thing) => !(!_.isObject(thing) || isBoxedType(thing) || isGenerator(thing)) const isBoxedType = (thing) => _.compact([ Boolean, Date, Number, RegExp, String, Symbol ]).some(type => thing instanceof type)