LCOV - code coverage report
Current view: top level - randomjs/utils - stringRepeat.ts (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 6 20 30.0 %
Date: 2021-03-12 10:43:40 Functions: 0 1 0.0 %

          Line data    Source code
       1           1 : export const stringRepeat = (() => {
       2           2 :   try {
       3           2 :     if (("x" as any).repeat(3) === "xxx") {
       4           0 :       return (pattern: string, count: number): string =>
       5           0 :         (pattern as any).repeat(count);
       6           2 :     }
       7           2 :   } catch (_) {
       8             :     // nothing to do here
       9           0 :   }
      10           0 :   return (pattern: string, count: number): string => {
      11           0 :     let result = "";
      12           0 :     while (count > 0) {
      13           0 :       if (count & 1) {
      14           0 :         result += pattern;
      15           0 :       }
      16           0 :       count >>= 1;
      17           0 :       pattern += pattern;
      18           0 :     }
      19           0 :     return result;
      20           0 :   };
      21           1 : })();

Generated by: LCOV version 1.15