Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a skipExternalValidations flag to allow users to skip external API calls and use only internal regex-based validation for EU TINs. This reverts the changes from commit 3de621c (PR #28) which forced all EU countries to use internal validation. The new approach restores external API validation as the default for most countries while giving users the option to skip it when needed (e.g., for performance, offline scenarios, or testing).
Changes:
- Added
skipExternalValidationsparameter tomask()function with default value offalse - Modified EU TIN validation logic to check both
config.validateInternallyandskipExternalValidationsflags - Removed
validateInternally: trueflags from most natural-person country configs (reverting PR #28), while keeping them for countries that must always use internal validation (BG, GB, IS, LI, NO) - Unskipped tests that verify external API validation behavior for countries without
validateInternallyflag - Added tests for the new
skipExternalValidationsflag behavior
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.js | Added skipExternalValidations parameter to mask() function signature and forwards it to euTinValidator.mask() |
| src/validators/eu-tin-validator.js | Added skipExternalValidations parameter to isValid() method and updated validation logic to check both flags with OR condition |
| src/validators/validators-by-country.js | Removed validateInternally: true flags from most natural-person country configs, restoring external API validation as default |
| test/src/validators/eu-tin-validator.test.js | Added test for skipExternalValidations flag, unskipped tests for external API validation, and added test verifying flag is passed to isValid() from mask() |
| test/src/index.test.js | Updated existing test expectation to include default skipExternalValidations: false value and added test for passing flag to euTinValidator.mask() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit 3de621c.
de5c408 to
be29121
Compare
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.
This PR adds a
skipExternalValidationsflag to allow users to skip external API calls and use only internal regex-based validation for EU TINs. This reverts the changes from commit 3de621c (PR #28) which forced all EU countries to use internal validation. The new approach restores external API validation as the default for most countries while giving users the option to skip it when needed (e.g., for performance, offline scenarios, or testing).