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.find-index.js 840B

12345678910111213141516171819202122
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var $findIndex = require('../internals/array-iteration').findIndex;
  4. var addToUnscopables = require('../internals/add-to-unscopables');
  5. var FIND_INDEX = 'findIndex';
  6. var SKIPS_HOLES = true;
  7. // Shouldn't skip holes
  8. // eslint-disable-next-line es/no-array-prototype-findindex -- testing
  9. if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
  10. // `Array.prototype.findIndex` method
  11. // https://tc39.es/ecma262/#sec-array.prototype.findindex
  12. $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  13. findIndex: function findIndex(callbackfn /* , that = undefined */) {
  14. return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  15. }
  16. });
  17. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  18. addToUnscopables(FIND_INDEX);