find.mjs 355 B

1234567891011121314
  1. /* eslint-disable no-redeclare */
  2. // $FlowFixMe
  3. var find = Array.prototype.find ? function (list, predicate) {
  4. return Array.prototype.find.call(list, predicate);
  5. } : function (list, predicate) {
  6. for (var _i2 = 0; _i2 < list.length; _i2++) {
  7. var value = list[_i2];
  8. if (predicate(value)) {
  9. return value;
  10. }
  11. }
  12. };
  13. export default find;