1 | 'use strict';
|
2 | var isObject = require('../internals/is-object');
|
3 | var definePropertyModule = require('../internals/object-define-property');
|
4 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
5 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
6 |
|
7 | var HAS_INSTANCE = wellKnownSymbol('hasInstance');
|
8 | var FunctionPrototype = Function.prototype;
|
9 |
|
10 |
|
11 |
|
12 | if (!(HAS_INSTANCE in FunctionPrototype)) {
|
13 | definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: function (O) {
|
14 | if (typeof this != 'function' || !isObject(O)) return false;
|
15 | if (!isObject(this.prototype)) return O instanceof this;
|
16 |
|
17 | while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
|
18 | return false;
|
19 | } });
|
20 | }
|