source: imaps-frontend/node_modules/es-abstract/2020/OrdinaryHasInstance.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 565 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var Get = require('./Get');
6var IsCallable = require('./IsCallable');
7var Type = require('./Type');
8
9// https://262.ecma-international.org/6.0/#sec-ordinaryhasinstance
10
11module.exports = function OrdinaryHasInstance(C, O) {
12 if (!IsCallable(C)) {
13 return false;
14 }
15 if (Type(O) !== 'Object') {
16 return false;
17 }
18 var P = Get(C, 'prototype');
19 if (Type(P) !== 'Object') {
20 throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
21 }
22 return O instanceof C;
23};
Note: See TracBrowser for help on using the repository browser.