Node-Red configuration
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.

es.array.index-of.js 973B

1234567891011121314151617181920212223
  1. 'use strict';
  2. /* eslint-disable es/no-array-prototype-indexof -- required for testing */
  3. var $ = require('../internals/export');
  4. var uncurryThis = require('../internals/function-uncurry-this-clause');
  5. var $indexOf = require('../internals/array-includes').indexOf;
  6. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  7. var nativeIndexOf = uncurryThis([].indexOf);
  8. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;
  9. var FORCED = NEGATIVE_ZERO || !arrayMethodIsStrict('indexOf');
  10. // `Array.prototype.indexOf` method
  11. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  12. $({ target: 'Array', proto: true, forced: FORCED }, {
  13. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  14. var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
  15. return NEGATIVE_ZERO
  16. // convert -0 to +0
  17. ? nativeIndexOf(this, searchElement, fromIndex) || 0
  18. : $indexOf(this, searchElement, fromIndex);
  19. }
  20. });