Skip to content

Add string utility function: isValidSwissSocialSecurityNumber - #78

Merged
drebrez merged 19 commits into
neolution-ch:mainfrom
dom-baur:feature/ahvnumber-check
Sep 3, 2025
Merged

drebrez merged 19 commits into
neolution-ch:mainfrom
dom-baur:feature/ahvnumber-check

Conversation

@dom-baur

Copy link
Copy Markdown
Contributor

Add string utility function isValidSwissSocialSecurityNumber for issue #77

@dom-baur
dom-baur requested a review from a team as a code owner August 27, 2025 08:52
@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2025 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/neolution-ch/javascript-utils/@neolution-ch/javascript-utils@78

commit: 933ef62

Comment thread src/lib/string.ts Outdated
@dom-baur
dom-baur requested a review from fwermelinger August 27, 2025 13:46
@dom-baur

Copy link
Copy Markdown
Contributor Author

This part of the code is probably not the best solution. Is there a better way to solve this?

// code is never undefined!
return (code! - 55).toString();

@neoscie
neoscie requested a review from Copilot August 27, 2025 13:57

This comment was marked as outdated.

neoscie and others added 3 commits August 27, 2025 15:59
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.spec.ts Outdated
@dom-baur
dom-baur requested a review from drebrez August 28, 2025 07:05
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts
@neoscie
neoscie requested a review from Copilot August 29, 2025 12:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new string utility function isValidSwissSocialSecurityNumber that validates Swiss social security numbers (AHV numbers) with checksum verification according to the official Swiss format specification.

  • Adds validation function for Swiss social security numbers with checksum calculation
  • Supports both dotted format (756.XXXX.XXXX.XX) and compact format (756XXXXXXXXXX)
  • Includes comprehensive test coverage for various valid and invalid input scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib/string.ts Implements the Swiss social security number validation function with checksum verification
src/lib/string.spec.ts Adds test cases covering valid/invalid formats and edge cases
CHANGELOG.md Documents the new utility function in the unreleased section

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts Outdated
Comment thread src/lib/string.ts
neoscie and others added 2 commits August 29, 2025 14:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/lib/string.ts Outdated
@github-actions

github-actions Bot commented Sep 1, 2025

Copy link
Copy Markdown
Package Line Rate Branch Rate Complexity Health
main 100% 100% 0 ✔
Summary 100% (174 / 174) 100% (91 / 91) 0 ✔

@drebrez
drebrez merged commit 18d0936 into neolution-ch:main Sep 3, 2025
5 checks passed
@dom-baur
dom-baur deleted the feature/ahvnumber-check branch September 3, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants