es6.array.index-of.js 605 B

123456789101112131415
  1. 'use strict';
  2. var $export = require('./_export')
  3. , $indexOf = require('./_array-includes')(false)
  4. , $native = [].indexOf
  5. , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
  6. $export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
  7. // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
  8. indexOf: function indexOf(searchElement /*, fromIndex = 0 */){
  9. return NEGATIVE_ZERO
  10. // convert -0 to +0
  11. ? $native.apply(this, arguments) || 0
  12. : $indexOf(this, searchElement, arguments[1]);
  13. }
  14. });