Version 1
[yaffs-website] / node_modules / core-js / modules / es6.function.has-instance.js
diff --git a/node_modules/core-js/modules/es6.function.has-instance.js b/node_modules/core-js/modules/es6.function.has-instance.js
new file mode 100644 (file)
index 0000000..ae294b1
--- /dev/null
@@ -0,0 +1,13 @@
+'use strict';
+var isObject       = require('./_is-object')
+  , getPrototypeOf = require('./_object-gpo')
+  , HAS_INSTANCE   = require('./_wks')('hasInstance')
+  , FunctionProto  = Function.prototype;
+// 19.2.3.6 Function.prototype[@@hasInstance](V)
+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;
+  // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
+  while(O = getPrototypeOf(O))if(this.prototype === O)return true;
+  return false;
+}});
\ No newline at end of file