2016-10-10 03:43:44 +02:00
|
|
|
'use strict';
|
2017-08-14 05:01:11 +02:00
|
|
|
var isObject = require('./_is-object');
|
|
|
|
var getPrototypeOf = require('./_object-gpo');
|
|
|
|
var HAS_INSTANCE = require('./_wks')('hasInstance');
|
|
|
|
var FunctionProto = Function.prototype;
|
2016-10-10 03:43:44 +02:00
|
|
|
// 19.2.3.6 Function.prototype[@@hasInstance](V)
|
2017-08-14 05:01:11 +02:00
|
|
|
if (!(HAS_INSTANCE in FunctionProto)) require('./_object-dp').f(FunctionProto, HAS_INSTANCE, { value: function (O) {
|
|
|
|
if (typeof this != 'function' || !isObject(O)) return false;
|
|
|
|
if (!isObject(this.prototype)) return O instanceof this;
|
2016-10-10 03:43:44 +02:00
|
|
|
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
|
2017-08-14 05:01:11 +02:00
|
|
|
while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
|
2016-10-10 03:43:44 +02:00
|
|
|
return false;
|
2017-08-14 05:01:11 +02:00
|
|
|
} });
|