UNPKG

637 BJavaScriptView Raw
1'use strict';
2var isPrototypeOf = require('../../internals/object-is-prototype-of');
3var arrayMethod = require('../array/virtual/includes');
4var stringMethod = require('../string/virtual/includes');
5
6var ArrayPrototype = Array.prototype;
7var StringPrototype = String.prototype;
8
9module.exports = function (it) {
10 var own = it.includes;
11 if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod;
12 if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) {
13 return stringMethod;
14 } return own;
15};