ngx-iban-validator 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,15 @@
1
1
  # IBAN Validator
2
+
2
3
  IBAN Validator for your reactive Angular forms, comes without any dependencies and can be used even outside of Angular as standalone function in any JS project. It can perform format, digit and length IBAN validations.
3
4
 
4
5
  ## Install
6
+
5
7
  ```bash
6
8
  npm install ngx-iban-validator --save
7
9
  ```
8
10
 
9
11
  ## Use as a form validator
12
+
10
13
  Import validateIBAN function from ngx-iban-validator package into your component file. Add validateIBAN to your form validators array.
11
14
 
12
15
  ```typescript
@@ -18,30 +21,25 @@ import { validateIBAN } from 'ngx-iban-validator';
18
21
  @Component({
19
22
  selector: 'app-root',
20
23
  templateUrl: './app.component.html',
21
- styleUrls: ['./app.component.scss']
24
+ styleUrls: ['./app.component.scss'],
22
25
  })
23
26
  export class AppComponent implements OnInit {
24
-
25
27
  ibanForm: FormGroup;
26
28
 
27
- constructor(
28
- private formBuilder: FormBuilder
29
- ) {}
29
+ constructor(private formBuilder: FormBuilder) {}
30
30
 
31
31
  ngOnInit() {
32
32
  this.ibanForm = this.formBuilder.group({
33
- iban: ['', [
34
- Validators.required,
35
- validateIBAN
36
- ]]
33
+ iban: ['', [Validators.required, validateIBAN]],
37
34
  });
38
35
  }
39
-
40
36
  }
41
37
  ```
42
38
 
43
39
  ## Display error
44
- Validator is returning object as result of checks.
40
+
41
+ Validator is returning object as result of checks.
42
+
45
43
  ```typescript
46
44
  export interface IBANValidationResult {
47
45
  ibanInvalid: boolean;
@@ -56,10 +54,13 @@ export interface IBANError {
56
54
  ```
57
55
 
58
56
  Error object contains more details about validation error. You can display errors easily as with any other validator.
57
+
59
58
  ```html
60
59
  <form [formGroup]="ibanForm">
61
60
  <input type="text" formControlName="iban" />
62
- <small *ngIf="ibanForm.get('iban').errors && ibanForm.get('iban').errors.ibanInvalid">
61
+ <small
62
+ *ngIf="ibanForm.get('iban').errors && ibanForm.get('iban').errors.ibanInvalid"
63
+ >
63
64
  <span *ngIf="ibanForm.get('iban').errors.error.countryUnsupported">
64
65
  Country not supported
65
66
  </span>
@@ -74,16 +75,35 @@ Error object contains more details about validation error. You can display error
74
75
  ```
75
76
 
76
77
  ## Use as standalone function
78
+
77
79
  You can use validateIBAN function independently from any forms. Function will check IBAN and return object { ibanInvalid: boolean }
80
+
78
81
  ```typescript
79
- const ibanIsInvalid = validateIBAN({ value: 'AL35202111090000000001234567' }).ibanInvalid;
80
- ```
82
+ const ibanIsInvalid = validateIBAN({
83
+ value: 'AL35202111090000000001234567',
84
+ }).ibanInvalid;
85
+ ```
86
+
87
+ # NodeJS
81
88
 
82
- # NodeJS
83
- ```javascript
89
+ ```javascript
84
90
  const ibanValidator = require('ngx-iban-validator');
85
- const ibanIsInvalid = ibanValidator.validateIBAN({ value: 'BA393385804800211234' }).ibanInvalid;
91
+ const ibanIsInvalid = ibanValidator.validateIBAN({
92
+ value: 'BA393385804800211234',
93
+ }).ibanInvalid;
86
94
  ```
87
95
 
96
+ # Build
97
+
98
+ ```bash
99
+ npm i
100
+ npx tsc
101
+ ```
102
+
103
+ # v 1.0.1
104
+
105
+ Updated length for CR to 22 - @freddy36
106
+
88
107
  ## Read more
108
+
89
109
  [IBAN Examples](https://www.iban.com/structure)
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateIBAN = void 0;
3
4
  function validateIBAN(control) {
4
5
  var codeLengths = {
5
- AD: 24, AE: 23, AL: 28, AT: 20, AZ: 28, BA: 20, BE: 16, BG: 22, BH: 22, BR: 29, BY: 28, CH: 21, CR: 21, CY: 28, CZ: 24,
6
+ AD: 24, AE: 23, AL: 28, AT: 20, AZ: 28, BA: 20, BE: 16, BG: 22, BH: 22, BR: 29, BY: 28, CH: 21, CR: 22, CY: 28, CZ: 24,
6
7
  DE: 22, DK: 18, DO: 28, EE: 20, EG: 29, ES: 24, LC: 30, FI: 18, FO: 18, FR: 27, GB: 22, GI: 23, GL: 18, GE: 22, GR: 27,
7
8
  GT: 28, HR: 21, HU: 28, IE: 22, IL: 23, IS: 26, IT: 27, IQ: 23, JO: 30, KW: 30, KZ: 20, LB: 28, LI: 21, LT: 20, LU: 20,
8
9
  LV: 21, MC: 27, MD: 24, ME: 22, MK: 19, MR: 27, MT: 31, MU: 30, NL: 18, NO: 15, PK: 24, PL: 28, PS: 29, PT: 25, QA: 29,
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateIBAN = void 0;
3
4
  var iban_validator_1 = require("./iban.validator");
4
- exports.validateIBAN = iban_validator_1.validateIBAN;
5
+ Object.defineProperty(exports, "validateIBAN", { enumerable: true, get: function () { return iban_validator_1.validateIBAN; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-iban-validator",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/SKaDiZZ/ngx-iban-validator"
@@ -11,7 +11,7 @@
11
11
  "author": {
12
12
  "name": "Samir Kahvedzic",
13
13
  "email": "akirapowered@gmail.com",
14
- "url": "https://virtuooza.com"
14
+ "url": "https://samirkahvedzic.info"
15
15
  },
16
16
  "description": "IBAN Validator for your reactive Angular forms, comes without any dependencies and can be used even outside of Angular as standalone function in any JS project. It can perform format, digit and length IBAN validations.",
17
17
  "main": "dist/index.js",
@@ -29,5 +29,8 @@
29
29
  "forms",
30
30
  "input"
31
31
  ],
32
- "license": "MIT"
32
+ "license": "MIT",
33
+ "devDependencies": {
34
+ "typescript": "^4.5.5"
35
+ }
33
36
  }