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
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var $TypeError = require('es-errors/type');
|
---|
| 4 |
|
---|
| 5 | var Get = require('./Get');
|
---|
| 6 | var IsCallable = require('./IsCallable');
|
---|
[79a0317] | 7 |
|
---|
| 8 | var isObject = require('../helpers/isObject');
|
---|
[d565449] | 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 | }
|
---|
[79a0317] | 16 | if (!isObject(O)) {
|
---|
[d565449] | 17 | return false;
|
---|
| 18 | }
|
---|
| 19 | var P = Get(C, 'prototype');
|
---|
[79a0317] | 20 | if (!isObject(P)) {
|
---|
[d565449] | 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.