main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
567 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 |
|
---|
8 | var isObject = require('../helpers/isObject');
|
---|
9 |
|
---|
10 | // https://262.ecma-international.org/6.0/#sec-ordinaryhasinstance
|
---|
11 |
|
---|
12 | module.exports = function OrdinaryHasInstance(C, O) {
|
---|
13 | if (!IsCallable(C)) {
|
---|
14 | return false;
|
---|
15 | }
|
---|
16 | if (!isObject(O)) {
|
---|
17 | return false;
|
---|
18 | }
|
---|
19 | var P = Get(C, 'prototype');
|
---|
20 | if (!isObject(P)) {
|
---|
21 | throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
|
---|
22 | }
|
---|
23 | return O instanceof C;
|
---|
24 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.