functioninstanceOf(left, right){if(typeof right !=="function")thrownewTypeError("Uncaught TypeError: Right-hand side of "instanceof" is not an object");if(obj ===null||!/^(object|function)$/i.test(typeof left))returnfalse;if(!right.prototype)thrownewTypeError("TypeError: Function has non-object prototype 'undefined' in instanceof check");let hasInstance =typeof Symbol !=="undefined"&& right[Symbol.hasInstance];if(hasInstance){returnhasInstance.call(right, left);/* right[Symbol.hasInstance](left) */}let proto = Object.getPrototypeOf(obj);while(proto){if(proto === right.prototype)returntrue;
proto = Object.getPrototypeOf(proto);}returnfalse;}