https://github.com/lemoncode/fonk-iban-validator
IBAN validator for https://github.com/Lemoncode/fonk
https://github.com/lemoncode/fonk-iban-validator
Last synced: 9 months ago
JSON representation
IBAN validator for https://github.com/Lemoncode/fonk
- Host: GitHub
- URL: https://github.com/lemoncode/fonk-iban-validator
- Owner: Lemoncode
- License: mit
- Created: 2019-09-11T14:46:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-07T09:09:53.000Z (about 6 years ago)
- Last Synced: 2025-05-08T01:43:42.307Z (9 months ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 5
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fonk-iban-validator
[](https://circleci.com/gh/Lemoncode/fonk-iban-validator/tree/master)
[](https://www.npmjs.com/package/@lemoncode/fonk-iban-validator)
[](https://bundlephobia.com/result?p=@lemoncode/fonk-iban-validator)
This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to:
- Validate if a field of a form is a valid IBAN
How to install it:
```bash
npm install @lemoncode/fonk-iban-validator --save
```
How to add it to an existing form validation schema:
We have the following form model:
```
const myFormValues = {
account: 'ES7921000813610123456789',
}
```
We can add a iban validation to the myFormValues
```javascript
import { iban } from '@lemoncode/fonk-iban-validator';
const validationSchema = {
field: {
account: [iban.validator],
},
};
```
You can customize the error message displayed in two ways:
- Globally, replace the default error message in all validationSchemas (e.g. porting to spanish):
```javascript
import { iban } from '@lemoncode/fonk-iban-validator';
iban.setErrorMessage('El campo debe tener un formato IBAN válido');
```
- Locally just override the error message for this validationSchema:
```javascript
import { iban } from '@lemoncode/fonk-iban-validator';
const validationSchema = {
field: {
account: [
{
validator: iban.validator,
message: 'Field should have a valid IBAN format',
},
],
},
};
```
Please, refer to [fonk](https://github.com/Lemoncode/fonk) to learn more about form validation.
## License
[MIT](./LICENSE)
# About Basefactor + Lemoncode
We are an innovating team of Javascript experts, passionate about turning your ideas into robust products.
[Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services.
[Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services.
For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend