UI for Zipcoin Blue

index.js 464B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. module.exports = function (arr, predicate, ctx) {
  3. if (typeof Array.prototype.findIndex === 'function') {
  4. return arr.findIndex(predicate, ctx);
  5. }
  6. if (typeof predicate !== 'function') {
  7. throw new TypeError('predicate must be a function');
  8. }
  9. var list = Object(arr);
  10. var len = list.length;
  11. if (len === 0) {
  12. return -1;
  13. }
  14. for (var i = 0; i < len; i++) {
  15. if (predicate.call(ctx, list[i], i, list)) {
  16. return i;
  17. }
  18. }
  19. return -1;
  20. };