You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
479 B
14 lines
479 B
4 years ago
|
var arrayAt = require('../array/virtual/at');
|
||
|
var stringAt = require('../string/virtual/at');
|
||
|
|
||
|
var ArrayPrototype = Array.prototype;
|
||
|
var StringPrototype = String.prototype;
|
||
|
|
||
|
module.exports = function (it) {
|
||
|
var own = it.at;
|
||
|
if (it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.at)) return arrayAt;
|
||
|
if (typeof it === 'string' || it === StringPrototype || (it instanceof String && own === StringPrototype.at)) {
|
||
|
return stringAt;
|
||
|
} return own;
|
||
|
};
|