Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rozpo/pesel
Dart package for validation of the national identification number used in Poland.
https://github.com/rozpo/pesel
Last synced: 9 days ago
JSON representation
Dart package for validation of the national identification number used in Poland.
- Host: GitHub
- URL: https://github.com/rozpo/pesel
- Owner: rozpo
- License: mit
- Created: 2023-08-24T10:42:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-24T11:08:30.000Z (over 1 year ago)
- Last Synced: 2023-08-24T11:19:34.392Z (over 1 year ago)
- Language: Dart
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PESEL Library
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/rozpo/pesel/dart.yml)
![Codecov](https://img.shields.io/codecov/c/github/rozpo/pesel)
![GitHub release (with filter)](https://img.shields.io/github/v/release/rozpo/pesel)
![GitHub](https://img.shields.io/github/license/rozpo/pesel)The PESEL library is a Dart package that provides functionality to work with PESEL (Personal Identification Number) in Poland. PESEL is used to identify individuals and contains information about birthdate and sex.
https://obywatel.gov.pl/pl/dokumenty-i-dane-osobowe/czym-jest-numer-pesel
## Installation
To use this library in your Dart project, add the following dependency to your `pubspec.yaml` file:
```yaml
dependencies:
pesel: ^1.0.0
```Then, run `dart pub get` to fetch the package.
## Usage
```dart
import 'package:pesel/pesel.dart';void main() {
// Create a Pesel instance
final peselString = "22291028314";
final pesel = Pesel(peselString);// Print the PESEL number
print(pesel);// Check if the PESEL is valid
if (pesel.isValid) {
print("This PESEL is valid.");
} else {
print("This PESEL is not valid.");
}// Check if the PESEL belongs to a male or female
if (pesel.isMale) {
print("This PESEL belongs to a male.");
} else if (pesel.isFemale) {
print("This PESEL belongs to a female.");
}// Print the sex of the individual
print("Sex: ${pesel.sex}");// Print the date of birth
print("Date of Birth: ${pesel.dateOfBirth}");
}
```## API Reference
### Class: Pesel
Represents a PESEL (Personal Identification Number) in Poland, used to identify individuals.
#### Constructors
- `Pesel(String pesel)`: Creates a Pesel instance from a valid PESEL string.
#### Properties
- `bool isMale`: Checks if the PESEL belongs to a male individual.
- `bool isFemale`: Checks if the PESEL belongs to a female individual.
- `bool isValid`: Checks if the PESEL is valid based on its checksum.
- `DateTime dateOfBirth`: Retrieves the date of birth associated with the PESEL.
- `Sex sex`: Determines the sex of the individual associated with the PESEL.### Enum: Sex
Represents the biological sex of an individual.
- `male`: Represents the male sex.
- `female`: Represents the female sex.## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.