source: trip-planner-front/node_modules/core-js/modules/es.function.has-instance.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 926 bytes
Line 
1'use strict';
2var isObject = require('../internals/is-object');
3var definePropertyModule = require('../internals/object-define-property');
4var getPrototypeOf = require('../internals/object-get-prototype-of');
5var wellKnownSymbol = require('../internals/well-known-symbol');
6
7var HAS_INSTANCE = wellKnownSymbol('hasInstance');
8var FunctionPrototype = Function.prototype;
9
10// `Function.prototype[@@hasInstance]` method
11// https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance
12if (!(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 // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
17 while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
18 return false;
19 } });
20}
Note: See TracBrowser for help on using the repository browser.