• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

reactivando / validations-br / 17783612896

17 Sep 2025 01:17AM UTC coverage: 91.96% (-0.4%) from 92.345%
17783612896

push

github

web-flow
feat: optimize build with tsdown (#49)

* feat: optimize build with tsdown

- Replace tsc with tsdown for a smaller bundle size.
- Generate both CJS and ESM modules.
- Update documentation to use pnpm.

* feat: optimize build with tsdown and add e2e test

- Replace tsc with tsdown for a smaller bundle size.
- Generate both CJS and ESM modules.
- Update documentation to use pnpm.
- Add an example project to test the built package.
- Add a GitHub Action to run e2e tests on pull requests.

* feat: optimize build, add e2e tests and bundle analysis

- Replace tsc with tsdown for a smaller, optimized bundle.
- Generate both CJS and ESM modules for modern compatibility.
- Refactor `validateIE` to use dynamic imports, significantly reducing the main bundle size.
- Add `"sideEffects": false` to package.json to enable more aggressive tree-shaking.
- Add an example project to perform end-to-end testing on the built package.
- Add a GitHub Action to automate e2e tests on pull requests.
- Integrate a bundle analyzer (`rollup-plugin-visualizer`) to inspect bundle composition.
- Update documentation to include `pnpm` and correct contribution guidelines.
- Update .gitignore to exclude build artifacts and local dependencies.

* feat: optimize build with tsdown and add e2e test

- Replace tsc with tsdown for a smaller, optimized bundle.
- Generate both CJS and ESM modules for modern compatibility.
- Add an example project to perform end-to-end testing on the built package.
- Add a GitHub Action to automate e2e tests on pull requests.
- Integrate a bundle analyzer (`rollup-plugin-visualizer`) to inspect bundle composition.
- Add `"sideEffects": false` to package.json to enable more aggressive tree-shaking.
- Update documentation to include `pnpm` and correct contribution guidelines.
- Update .gitignore to exclude build artifacts and local dependencies.
- Keep `validateIE` synchronous to maintain API consistency, as requested.

* feat: optimize build for tree-shaking and... (continued)

222 of 252 branches covered (88.1%)

Branch coverage included in aggregate %.

693 of 743 relevant lines covered (93.27%)

9.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/validations/utils.ts
1
/**
2
 * The function `isRepeated` checks if a given string consists of repeated characters.
3
 * @param {string} ref - The `ref` parameter is a string that you want to check for repeated
4
 * characters.
5
 * @returns a boolean value.
6
 */
7
export const isRepeated = (ref: string) => {
1✔
8
  const ret = ref.replace(new RegExp(ref[0], 'g'), '').trim().length === 0;
64✔
9
  return ret;
64✔
10
};
64✔
11

12
/**
13
 * The `mod11` function calculates the MOD11 checksum for a given value with a specified limit.
14
 * @param {string} clearValue - The `clearValue` parameter is a string that represents the numeric
15
 * value for which you want to calculate the MOD11 checksum. It should not contain any non-digit
16
 * characters.
17
 * @param {number} limite - The `limite` parameter in the `mod11` function represents the upper limit
18
 * for the multiplier used in the calculation. The multiplier starts at 2 and increments by 1 for each
19
 * digit of the input `clearValue`. When the multiplier exceeds the `limite`, it resets back to 2.
20
 * @returns The `mod11` function returns a number, which is the calculated check digit (DV).
21
 */
22
export const mod11 = (clearValue: string, limite: number): number => {
1✔
23
  const valor = String(clearValue).replace(/\D/g, '');
26✔
24
  let sum = 0;
26✔
25
  let mult = 2;
26✔
26

27
  for (let i = valor.length - 1; i >= 0; i--) {
26✔
28
    sum += mult * +valor[i];
247✔
29
    if (++mult > limite) {
247!
30
      mult = 2;
×
31
    }
×
32
  }
247✔
33
  const dv = ((sum * 10) % 11) % 10;
26✔
34
  return dv;
26✔
35
};
26✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc