Harden validator and prep for v2 release#12
Merged
Conversation
- Rename src/dannish-ssn.js -> src/danish-ssn.js (typo fix) - Rename testLuhn (was teshLuhn); keep alias for back-compat - Tighten Finnish SSN regex (drop spurious | inside char class) - Resolve 2-digit years against current century instead of hardcoding 2000 - Validate separator position in SE/DK input; reject misplaced hyphens - Reject non-digit Norwegian input early - Add index.d.ts and tsd-style type tests; wire up tsc in test script - Migrate ESLint config to flat config (eslint.config.js) - Restructure tests: per-country files, shared fixtures, package smoke test - Replace single workflow with CI matrix (lint + test on Node 18/20/22 + build) - Bump devDependencies; raise engines.node to >=18 - Add files allowlist and prepublishOnly to package.json - Rewrite README with API table, accepted formats, and per-country rules
CodeQL flagged that the workflow didn't declare a permissions block, defaulting to the repo's broad token scope. We only need contents:read.
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
Stabilizing the package ahead of a more robust release. This bundles bug fixes, a real type story, modernized tooling, and a restructured test suite.
Bug fixes
+ 2000(aYYof99no longer becomes year 2099).[-|U-Y]character class accidentally allowed a literal|.'8601-013496'and similar misplaced hyphens are now rejected instead of silently stripped.teshLuhn->testLuhn; the old name is kept as an alias for back-compat.Types
index.d.tswithValidator,CountryCode, andValidatorInput.test/types.test-d.tsand runtscas part ofnpm test.Tooling
eslint.config.js); bump to ESLint 9.engines.nodeto>=18.filesallowlist andprepublishOnlyscript topackage.jsonso publishes only shipdist/+index.d.ts.Tests
test/test.jsinto per-country files plus a sharedtest/fixtures.jsand atest/package.test.jssmoke test for the public API.src/dannish-ssn.js->src/danish-ssn.js(typo fix).Docs
README.mdwith badges, an API table, accepted formats per country, and explicit notes on which checksums are validated (DK mod-11 was phased out in 2007 and is intentionally not checked).Test plan
npm run lintcleannpm test— 295 tests pass,tscpassesnpm packonly containsdist/andindex.d.ts