@radziszd/pesel-utils
v1.1.0
Published
A TypeScript library for validating and parsing Polish PESEL numbers
Maintainers
Readme
PESEL Utils
A TypeScript library for validating and parsing Polish PESEL numbers.
Installation
npm install pesel-utilsUsage
In Node.js
const { Pesel } = require('pesel-utils');
// or
import { Pesel } from 'pesel-utils';
// Parse a PESEL number
const result = Pesel.parse('12345678901');
if (result) {
console.log('Birth date:', result.birthDate);
console.log('Gender:', result.gender);
} else {
console.log('Invalid PESEL');
}In Browser
<script type="module">
import { Pesel } from 'https://cdn.jsdelivr.net/npm/pesel-utils/dist/index.esm.js';
const result = Pesel.parse('12345678901');
if (result) {
console.log('Birth date:', result.birthDate);
console.log('Gender:', result.gender);
}
</script>
## Development
1. Clone the repository
2. Install dependencies: `npm install`
3. Build the library: `npm run build`
4. Run tests: `npm test`