Add getProcessoJuridicoInfo and getVoterIdInfo - #619
Conversation
Reads a Número Único de Processo (Resolução CNJ nº 65/2008) into its layout fields: the sequential number, the check digits, the year of filing, the segment of the Judiciary (as a name and as the raw J digit), the tribunal code (TR) and the unit of origin (OOOO). It takes the same input as isValidProcessoJuridico and returns null exactly when that function returns false, so the J and TR pair always comes from the tables the validator already reads. The tribunal is exposed as its code only: the repository has no table of tribunal names, and the resolution leaves the unit of origin to each tribunal.
Reads a título de eleitor into its fields: the 8 digit sequential number, the federative union code (01 to 28), the state it stands for and the 2 check digits. It takes the same input as isValidVoterId and returns null exactly when that function returns false. A voter id issued without the leading zeros of its sequential number is left padded to 12 digits the way isValidVoterId reads it, so the sequential number always has 8 digits. The code 28 (ZZ, voters abroad) has no state, so its state is null. The state is found by reading the existing UF_TO_VOTER_ID_CODE table backwards, so no second table is kept.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
Tree-shaking report✅ No size regression. 2 new out of 200 exports.
What changed (2)
All exports (200)
How this is measuredEvery export is imported alone into an esbuild consumer bundle (minified, tree-shaken) built from the head and from the base of this pull request; the sizes are the resulting bundles, gzip is their gzipped size. 🔴 marks a regression: a pre-existing export that grew more than 20% and more than 256 B, or the bundle importing every pre-existing export growing more than 5%. 🟡 is growth under the threshold, 🟢 a decrease, ⚪ no change, 🆕 an export that does not exist on the base (never a regression), 🗑️ an export that was removed. An intentional increase is accepted with the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## claude/perf-hot-paths #619 +/- ##
=======================================================
Coverage 100.00% 100.00%
=======================================================
Files 261 263 +2
Lines 2640 2656 +16
Branches 752 754 +2
=======================================================
+ Hits 2640 2656 +16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fourth PR of the stack (base: #617). Two new readers the maintainer asked for, completing the
get*Infofamily.getProcessoJuridicoInfo(value)Reads a Número Único de Processo (Resolução CNJ nº 65/2008,
NNNNNNN-DD.AAAA.J.TR.OOOO).nullexactly whenisValidProcessoJuridico(value)isfalse; otherwise a freshProcessoJuridicoInfo:segmentis the newProcessoJuridicoSegmenttype (supreme-federal-court,national-council-of-justice,superior-court-of-justice,federal,labor,electoral,military,state,state-military). The J and TR tables ofisValidProcessoJuridicoare reused; the package has no table of tribunal names, so onlytribunalCodeis returned and the docs explain00and90.getVoterIdInfo(value)Reads a título de eleitor.
nullexactly whenisValidVoterId(value)isfalse; otherwise a freshVoterIdInfo:stateCodeisnullfor the code28(ZZ, voters abroad), and the state comes from the existingUF_TO_VOTER_ID_CODEtable read backwards (no second table). Shorter values are read the wayisValidVoterIdreads them, sosequentialNumberalways has 8 digits.Size and gates
getProcessoJuridicoInfo1,117 B / 623 B gzip andgetVoterIdInfo1,301 B / 750 B as single imports.vp check, 8,520 tests with 100% coverage (also underTZ=America/Sao_Paulo), Bun, Deno, build, jscpd, knip,check:api, Stryker 100% on both new files, commitlint. Docs in EN and PT.