massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / es.function.has-instance.js
1 'use strict';
2 var isCallable = require('../internals/is-callable');
3 var isObject = require('../internals/is-object');
4 var definePropertyModule = require('../internals/object-define-property');
5 var getPrototypeOf = require('../internals/object-get-prototype-of');
6 var wellKnownSymbol = require('../internals/well-known-symbol');
7
8 var HAS_INSTANCE = wellKnownSymbol('hasInstance');
9 var FunctionPrototype = Function.prototype;
10
11 // `Function.prototype[@@hasInstance]` method
12 // https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance
13 if (!(HAS_INSTANCE in FunctionPrototype)) {
14   definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: function (O) {
15     if (!isCallable(this) || !isObject(O)) return false;
16     var P = this.prototype;
17     if (!isObject(P)) return O instanceof this;
18     // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
19     while (O = getPrototypeOf(O)) if (P === O) return true;
20     return false;
21   } });
22 }