main
Last change
on this file since d565449 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 |
|
---|
3 | var $TypeError = require('es-errors/type');
|
---|
4 |
|
---|
5 | var Get = require('./Get');
|
---|
6 | var IsCallable = require('./IsCallable');
|
---|
7 | var Type = require('./Type');
|
---|
8 |
|
---|
9 | // https://262.ecma-international.org/6.0/#sec-ordinaryhasinstance
|
---|
10 |
|
---|
11 | module.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.