Urara-Blog/node_modules/.pnpm-store/v3/files/2f/3075044ec2f3723be45aa129144000c9be974bc38f9a199803999a29818307614ff2f98ccbcaf0b4042b05bd87630e31b6a59c7b626cda5f18ee059f185087
2022-08-14 01:14:53 +08:00

25 lines
627 B
Text

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Get = require('./Get');
var IsCallable = require('./IsCallable');
var Type = require('./Type');
// https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance
module.exports = function OrdinaryHasInstance(C, O) {
if (IsCallable(C) === false) {
return false;
}
if (Type(O) !== 'Object') {
return false;
}
var P = Get(C, 'prototype');
if (Type(P) !== 'Object') {
throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
}
return O instanceof C;
};