Skip to content

Commit

Permalink
Merge pull request #100 from koblas/package_updates
Browse files Browse the repository at this point in the history
fix: updated packages
  • Loading branch information
koblas committed Aug 24, 2023
2 parents 9b20bff + 40c62f7 commit 31c95a4
Show file tree
Hide file tree
Showing 13 changed files with 1,849 additions and 1,115 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install semantic-release extra plugins
Expand Down
2,585 changes: 1,545 additions & 1,040 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/jest": "^29.5.0",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"eslint": "^8.22.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
Expand Down
6 changes: 3 additions & 3 deletions src/be/bis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { InvalidLength, InvalidChecksum, InvalidFormat } from '../exceptions';

describe('be/bis', () => {
it('format:88 22 29-999.70', () => {
const result = format('88 02 29-999.70')
const result = format('88 02 29-999.70');

expect(result).toEqual('88022999970');
});
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('be/bis', () => {
const result = validate('08222999935');

expect(result.error).toBeInstanceOf(InvalidChecksum);
})
});

it('validate:96531699935', () => {
// A number with an offset of 40, should be invalid due to invalid month
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('be/bis', () => {
// A number with an unknown dob offset by 40, should be invalid by checksum
const result = validate('01400199981');

expect(result.error).toBeInstanceOf(InvalidChecksum)
expect(result.error).toBeInstanceOf(InvalidChecksum);
});

it('validate:00290199976', () => {
Expand Down
36 changes: 22 additions & 14 deletions src/be/bis.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
/**
* The BIS (Belgian Number for Foreigners) is an identifier for individuals such
* as cross-border workers who do not have a Belgian National Number. It has the
* same format as the Belgian National Number, but the month digits are increased
* by 40 if the sex of the person was known when the number was assigned and by
* 20 if not.
*
* Source
* https://fr.wikipedia.org/wiki/Numéro_de_registre_national (Numéro de sécurité sociale)
*
* PERSON
*/
* The BIS (Belgian Number for Foreigners) is an identifier for individuals such
* as cross-border workers who do not have a Belgian National Number. It has the
* same format as the Belgian National Number, but the month digits are increased
* by 40 if the sex of the person was known when the number was assigned and by
* 20 if not.
*
* Source
* https://fr.wikipedia.org/wiki/Numéro_de_registre_national (Numéro de sécurité sociale)
*
* PERSON
*/

import * as exceptions from '../exceptions';
import { strings } from '../util';
import { validStructure, validChecksum, toDateArray } from './personIdentifierHelpers';
import {
validStructure,
validChecksum,
toDateArray,
} from './personIdentifierHelpers';
import { Validator, ValidateReturn } from '../types';

function clean(input: string): ReturnType<typeof strings.cleanUnicode> {
Expand All @@ -22,9 +26,13 @@ function clean(input: string): ReturnType<typeof strings.cleanUnicode> {

function toDob(firstSix: string): string {
const [y, m, d] = toDateArray(firstSix).map(s => parseInt(s, 10));
const adjustedDateArrays = [[y, m - 20, d], [y, m - 40, d]];
const adjustedDateArrays = [
[y, m - 20, d],
[y, m - 40, d],
];
// Allow 0 because a 0 month indicates an unknown DOB.
const dobArray = adjustedDateArrays.find(ada => ada[1] >= 0 && ada[1] <= 12) || [];
const dobArray =
adjustedDateArrays.find(ada => ada[1] >= 0 && ada[1] <= 12) || [];
return dobArray.map(n => `${n}`.padStart(2, '0')).join('');
}

Expand Down
22 changes: 12 additions & 10 deletions src/be/insz.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* The Belgian Social Security Identification Number is an 11 digit number.
* It can be either a National Register Number (NN, NISS) or BIS.
*
* Sources
* https://fr.wikipedia.org/wiki/Numéro_de_registre_national
* https://www2.deloitte.com/content/dam/Deloitte/be/Documents/tax/TaxAlerts/IndividualTaxAlerts/Social%20Security%20alert%20-%20BelgianIDpro%20-%2026%20Nov%202020.pdf
*
* PERSON
*/
* The Belgian Social Security Identification Number is an 11 digit number.
* It can be either a National Register Number (NN, NISS) or BIS.
*
* Sources
* https://fr.wikipedia.org/wiki/Numéro_de_registre_national
* https://www2.deloitte.com/content/dam/Deloitte/be/Documents/tax/TaxAlerts/IndividualTaxAlerts/Social%20Security%20alert%20-%20BelgianIDpro%20-%2026%20Nov%202020.pdf
*
* PERSON
*/

import { strings } from '../util';
import { validate as nnValidate } from './nn';
Expand Down Expand Up @@ -44,7 +44,9 @@ const impl: Validator = {
// invalid format. The identifier with the checksum error had correct
// formatting, so invalid checksum seems like the more descriptive error.

const checksumErrorResult = results.find(r => r.error && r.error.name === 'InvalidChecksum');
const checksumErrorResult = results.find(
r => r.error && r.error.name === 'InvalidChecksum',
);
return checksumErrorResult || results[0];
},
};
Expand Down
10 changes: 5 additions & 5 deletions src/es/cif.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ describe('es/cif', () => {
});

it.each(['J99216582', 'B86670460', 'Q2876031B', 'N0112768G', 'W8265365J'])(
'validate:%s',
(cif: string) => {
const result = validate(cif);
'validate:%s',
(cif: string) => {
const result = validate(cif);

expect(result.isValid && result.compact).toEqual(cif);
},
expect(result.isValid && result.compact).toEqual(cif);
},
);

it('validate:X13585626', () => {
Expand Down
Loading

0 comments on commit 31c95a4

Please sign in to comment.