Repository navigation
feat: add PIS/PASEP support to example demo - #60
Merged
Merged
Conversation
js-brasil already exposes pispasep in validateBr/maskBr/utilsBr.MASKS. Wire it into the example app's FORMATS list and add valid/invalid fixture values so it appears in both the masked-input and static tables. Closes mariohmol/ng-brazil#3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add GENERATORS in utils.js with random valid-value generators for all formats (CPF, CNPJ, CEP, RG, telefone, placa, renavam, titulo, time, currency, PIS/PASEP) using the same check-digit algorithms as js-brasil - Add Regenerate button in App that fills all masked inputs with fresh random valid values on each click (remounts rows via epoch key) - Fix renavam: was missing from DATA/DATARAW/DATAERROR, so the input started empty and never validated - Fix titulo: replace non-validating example value with a valid one computed via the create_titulo_atual algorithm Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two root causes:
- ValidatedRow.state.value was initialised with the raw generator output
(e.g. '0658' for time) but validators like validate_time require the
formatted value ('06:58'). Fix: initialise state.value via maskBr so
it always matches what the masked input displays.
- Time generator was returning raw 4-digit string ('HHMM') instead of
the 'HH:MM' format validate_time requires. Fix: include the colon.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
js-brasilalready implements PIS/PASEP validation, masking, and formatting under thepispasepkeypispasepto theFORMATSlist in the example app so it appears in both the masked-input table and the static valid/invalid table123.45678.91-9) and an invalid one (12345678918) to the fixture dataCloses mariohmol/ng-brazil#3
Test plan
pispaseprow appears in both tables###.#####.##-#🤖 Generated with Claude Code