massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / features / instance / at.js
index f9b4f7986dcbef36427f7b5b2fea037cfb71e57c..86ae5cf909188873c368c38c91324af906033d8b 100644 (file)
@@ -1,9 +1,14 @@
-var at = require('../string/virtual/at');
+var isPrototypeOf = require('../../internals/object-is-prototype-of');
+var arrayMethod = require('../array/virtual/at');
+var stringMethod = require('../string/virtual/at');
 
+var ArrayPrototype = Array.prototype;
 var StringPrototype = String.prototype;
 
 module.exports = function (it) {
   var own = it.at;
-  return typeof it === 'string' || it === StringPrototype
-    || (it instanceof String && own === StringPrototype.at) ? at : own;
+  if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.at)) return arrayMethod;
+  if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.at)) {
+    return stringMethod;
+  } return own;
 };