LCOV - code coverage report
Current view: top level - src/find - find.js (source / functions) Hit Total Coverage
Test: cov_profile.lcov Lines: 17 17 100.0 %
Date: 2021-12-16 00:47:58 Functions: 1 1 100.0 %
Branches: 10 10 100.0 %

           Branch data     Line data    Source code
       1                 :          2 : // TODO: document find
       2            [ + ]:          2 : const find = (Fiona) =>
       3                 :          4 :   (predicate, cb, { startseed = 0, tries = 1e6 } = {}) => {
       4            [ + ]:         16 :     let seed = startseed;
       5                 :         16 :     let seeded;
       6                 :         16 :     let value;
       7                 :         16 :     do {
       8       [ + ][ + ]:        216 :       seeded = Fiona(seed);
       9                 :        216 :       value = cb(seeded);
      10                 :         16 :     } while (seed++ < tries + startseed && !predicate(value));
      11       [ + ][ + ]:         16 :     if (seed > tries + startseed) {
      12       [ + ][ + ]:         18 :       throw Error(`Predicate not satisfied within ${tries} tries`);
      13                 :         16 :     }
      14       [ + ][ + ]:         26 :     return seeded.reset();
      15                 :          2 :   };
      16                 :          2 : 
      17                 :          1 : export default find;

Generated by: LCOV version 1.15