1918js
v0.0.9
Published
typescript validation library for polish identifiers: regon, nip, pesel
Maintainers
Readme
1918js
what is this?
validation library for polish identifiers
features
- validation utilities for polish identifiers: NIP, PESEL, REGON
- no external dependencies
- extensive testing (unit tests, property-based tests, mutation-tests)
how to use
import { validateRegon } from "1918js"
declare const someUnknownUserInput: unknown;
const result = validateRegon(someUnknownUserInput)
if(result.ok) {
console.log("happy path :)")
console.log("our value: ", result.value)
}
if(!result.ok) {
console.log("you know what path this is :(")
// error is accessed as a value, never thrown
console.log("error code", result.error.code)
}