at.js 593 B

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