d2823737ca5a339f0d9d5851249c2fffb8f6f96b
[dotfiles/.git] / includes.js
1 var arrayIncludes = require('../array/virtual/includes');
2 var stringIncludes = require('../string/virtual/includes');
3
4 var ArrayPrototype = Array.prototype;
5 var StringPrototype = String.prototype;
6
7 module.exports = function (it) {
8   var own = it.includes;
9   if (it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.includes)) return arrayIncludes;
10   if (typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.includes)) {
11     return stringIncludes;
12   } return own;
13 };