function isConstructor(o){ return typeof o === 'function' // per ES spec any callable is typed 'function' && o.prototype != null // filter out absent prototypes && (typeof o.prototype === 'object' // filter out primitive prototypes || typeof o.prototype === 'function') && Object.getPrototypeOf(o) !== Object.prototype // filter out non-constructable DOM interfaces && Object.getOwnPropertyNames(o.prototype).length > // ensure the prototype has at least one property {}.hasOwnProperty.call(o.prototype, 'constructor'); // ...besides 'constructor' }