(
C: object,
O: any,
internalSlots?: {boundTargetFunction: any}
)
| 6 | * https://tc39.es/ecma262/#sec-ordinaryhasinstance |
| 7 | */ |
| 8 | export function OrdinaryHasInstance( |
| 9 | C: object, |
| 10 | O: any, |
| 11 | internalSlots?: {boundTargetFunction: any} |
| 12 | ): boolean { |
| 13 | if (!IsCallable(C)) { |
| 14 | return false |
| 15 | } |
| 16 | if (internalSlots?.boundTargetFunction) { |
| 17 | let BC = internalSlots?.boundTargetFunction |
| 18 | return O instanceof BC |
| 19 | } |
| 20 | if (typeof O !== 'object') { |
| 21 | return false |
| 22 | } |
| 23 | let P = C.prototype |
| 24 | if (typeof P !== 'object') { |
| 25 | throw new TypeError( |
| 26 | 'OrdinaryHasInstance called on an object with an invalid prototype property.' |
| 27 | ) |
| 28 | } |
| 29 | return Object.prototype.isPrototypeOf.call(P, O) |
| 30 | } |
no test coverage detected