validation-br 1.5.2 → 2.0.0-next-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/.prettierrc +9 -0
- package/dist/jest.config.d.ts +8 -0
- package/dist/jest.config.d.ts.map +1 -0
- package/dist/jest.config.js +154 -0
- package/dist/jest.config.js.map +1 -0
- package/dist/test/_helpers/crc.spec.d.ts +2 -0
- package/dist/test/_helpers/crc.spec.d.ts.map +1 -0
- package/dist/test/_helpers/crc.spec.js +11 -0
- package/dist/test/_helpers/crc.spec.js.map +1 -0
- package/dist/test/carplate.spec.d.ts +2 -0
- package/dist/test/carplate.spec.d.ts.map +1 -0
- package/dist/test/carplate.spec.js +81 -0
- package/dist/test/carplate.spec.js.map +1 -0
- package/dist/test/cep.spec.d.ts +2 -0
- package/dist/test/cep.spec.d.ts.map +1 -0
- package/dist/test/cep.spec.js +95 -0
- package/dist/test/cep.spec.js.map +1 -0
- package/dist/test/cnh.spec.d.ts +2 -0
- package/dist/test/cnh.spec.d.ts.map +1 -0
- package/dist/test/cnh.spec.js +55 -0
- package/dist/test/cnh.spec.js.map +1 -0
- package/dist/test/cnpj.spec.d.ts +2 -0
- package/dist/test/cnpj.spec.d.ts.map +1 -0
- package/dist/test/cnpj.spec.js +105 -0
- package/dist/test/cnpj.spec.js.map +1 -0
- package/dist/test/cpf.spec.d.ts +2 -0
- package/dist/test/cpf.spec.d.ts.map +1 -0
- package/dist/test/cpf.spec.js +66 -0
- package/dist/test/cpf.spec.js.map +1 -0
- package/dist/test/index.test.d.ts +2 -0
- package/dist/test/index.test.d.ts.map +1 -0
- package/dist/test/index.test.js +77 -0
- package/dist/test/index.test.js.map +1 -0
- package/dist/test/judicial-process.spec.d.ts +2 -0
- package/dist/test/judicial-process.spec.d.ts.map +1 -0
- package/dist/test/judicial-process.spec.js +101 -0
- package/dist/test/judicial-process.spec.js.map +1 -0
- package/dist/test/nup17.spec.d.ts +2 -0
- package/dist/test/nup17.spec.d.ts.map +1 -0
- package/dist/test/nup17.spec.js +70 -0
- package/dist/test/nup17.spec.js.map +1 -0
- package/dist/test/phone.spec.d.ts +2 -0
- package/dist/test/phone.spec.d.ts.map +1 -0
- package/dist/test/phone.spec.js +79 -0
- package/dist/test/phone.spec.js.map +1 -0
- package/dist/test/pis-pasep.spec.d.ts +2 -0
- package/dist/test/pis-pasep.spec.d.ts.map +1 -0
- package/dist/test/pis-pasep.spec.js +65 -0
- package/dist/test/pis-pasep.spec.js.map +1 -0
- package/dist/test/pix-copy-paste.spec.d.ts +2 -0
- package/dist/test/pix-copy-paste.spec.d.ts.map +1 -0
- package/dist/test/pix-copy-paste.spec.js +31 -0
- package/dist/test/pix-copy-paste.spec.js.map +1 -0
- package/dist/test/pix-key.spec.d.ts +2 -0
- package/dist/test/pix-key.spec.d.ts.map +1 -0
- package/dist/test/pix-key.spec.js +36 -0
- package/dist/test/pix-key.spec.js.map +1 -0
- package/dist/test/postal-track-code.test.d.ts +2 -0
- package/dist/test/postal-track-code.test.d.ts.map +1 -0
- package/dist/test/postal-track-code.test.js +75 -0
- package/dist/test/postal-track-code.test.js.map +1 -0
- package/dist/test/renavam.spec.d.ts +2 -0
- package/dist/test/renavam.spec.d.ts.map +1 -0
- package/dist/test/renavam.spec.js +63 -0
- package/dist/test/renavam.spec.js.map +1 -0
- package/dist/test/tituloEleitor.spec.d.ts +2 -0
- package/dist/test/tituloEleitor.spec.d.ts.map +1 -0
- package/dist/test/tituloEleitor.spec.js +68 -0
- package/dist/test/tituloEleitor.spec.js.map +1 -0
- package/dist/test/utils-checkRepeatedSequence.test.d.ts +2 -0
- package/dist/test/utils-checkRepeatedSequence.test.d.ts.map +1 -0
- package/dist/test/utils-checkRepeatedSequence.test.js +18 -0
- package/dist/test/utils-checkRepeatedSequence.test.js.map +1 -0
- package/dist/test/utils-clearValue.test.d.ts +2 -0
- package/dist/test/utils-clearValue.test.d.ts.map +1 -0
- package/dist/test/utils-clearValue.test.js +74 -0
- package/dist/test/utils-clearValue.test.js.map +1 -0
- package/dist/test/utils-insertAtPosition.test.d.ts +2 -0
- package/dist/test/utils-insertAtPosition.test.d.ts.map +1 -0
- package/dist/test/utils-insertAtPosition.test.js +16 -0
- package/dist/test/utils-insertAtPosition.test.js.map +1 -0
- package/dist/test/utils-removeFromPosition.test.d.ts +2 -0
- package/dist/test/utils-removeFromPosition.test.d.ts.map +1 -0
- package/dist/test/utils-removeFromPosition.test.js +16 -0
- package/dist/test/utils-removeFromPosition.test.js.map +1 -0
- package/dist/test/utils-sumElementsByMultipliers.test.d.ts +2 -0
- package/dist/test/utils-sumElementsByMultipliers.test.d.ts.map +1 -0
- package/dist/test/utils-sumElementsByMultipliers.test.js +23 -0
- package/dist/test/utils-sumElementsByMultipliers.test.js.map +1 -0
- package/dist/test/utils-sumToDV.test.d.ts +2 -0
- package/dist/test/utils-sumToDV.test.d.ts.map +1 -0
- package/dist/test/utils-sumToDV.test.js +17 -0
- package/dist/test/utils-sumToDV.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/eslint.config.mjs +11 -0
- package/jest.config.ts +210 -0
- package/package.json +3 -3
- package/readme.md +3 -2
- package/test/_helpers/crc.spec.ts +13 -0
- package/test/carplate.spec.ts +85 -0
- package/test/cep.spec.ts +127 -0
- package/test/cnh.spec.ts +67 -0
- package/test/cnpj.spec.ts +127 -0
- package/test/cpf.spec.ts +76 -0
- package/test/index.test.ts +112 -0
- package/test/judicial-process.spec.ts +131 -0
- package/test/nup17.spec.ts +79 -0
- package/test/phone.spec.ts +87 -0
- package/test/pis-pasep.spec.ts +73 -0
- package/test/pix-copy-paste.spec.ts +37 -0
- package/test/pix-key.spec.ts +41 -0
- package/test/postal-track-code.test.ts +83 -0
- package/test/renavam.spec.ts +71 -0
- package/test/tituloEleitor.spec.ts +72 -0
- package/test/utils-checkRepeatedSequence.test.ts +17 -0
- package/test/utils-clearValue.test.ts +85 -0
- package/test/utils-insertAtPosition.test.ts +15 -0
- package/test/utils-removeFromPosition.test.ts +15 -0
- package/test/utils-sumElementsByMultipliers.test.ts +24 -0
- package/test/utils-sumToDV.test.ts +16 -0
- package/todo.md +32 -0
- package/tsconfig.json +103 -23
- package/.github/workflows/test.yml +0 -39
- package/.prettierrc.js +0 -7
- package/dist/cnh.d.ts +0 -91
- package/dist/cnh.js +0 -139
- package/dist/cnh.js.map +0 -1
- package/dist/cnh.test.d.ts +0 -1
- package/dist/cnpj.d.ts +0 -114
- package/dist/cnpj.js +0 -180
- package/dist/cnpj.js.map +0 -1
- package/dist/cnpj.test.d.ts +0 -1
- package/dist/cpf.d.ts +0 -99
- package/dist/cpf.js +0 -147
- package/dist/cpf.js.map +0 -1
- package/dist/cpf.test.d.ts +0 -1
- package/dist/data/ValidationBRError.d.ts +0 -6
- package/dist/data/ValidationBRError.js +0 -10
- package/dist/data/ValidationBRError.js.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -42
- package/dist/index.js.map +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/judicialProcess.d.ts +0 -126
- package/dist/judicialProcess.js +0 -190
- package/dist/judicialProcess.js.map +0 -1
- package/dist/judicialProcess.test.d.ts +0 -1
- package/dist/nup17.d.ts +0 -102
- package/dist/nup17.js +0 -155
- package/dist/nup17.js.map +0 -1
- package/dist/nup17.test.d.ts +0 -1
- package/dist/pisPasep.d.ts +0 -81
- package/dist/pisPasep.js +0 -126
- package/dist/pisPasep.js.map +0 -1
- package/dist/pisPasep.test.d.ts +0 -1
- package/dist/postalCode.d.ts +0 -83
- package/dist/postalCode.js +0 -136
- package/dist/postalCode.js.map +0 -1
- package/dist/postalCode.test.d.ts +0 -1
- package/dist/renavam.d.ts +0 -75
- package/dist/renavam.js +0 -122
- package/dist/renavam.js.map +0 -1
- package/dist/renavam.test.d.ts +0 -1
- package/dist/tituloEleitor.d.ts +0 -93
- package/dist/tituloEleitor.js +0 -143
- package/dist/tituloEleitor.js.map +0 -1
- package/dist/tituloEleitor.test.d.ts +0 -1
- package/dist/utils-applyMask.test.d.ts +0 -1
- package/dist/utils-checkRepeatedSequence.test.d.ts +0 -1
- package/dist/utils-clearValue.test.d.ts +0 -1
- package/dist/utils-fakeNumber.test.d.ts +0 -1
- package/dist/utils-insertAtPosition.test.d.ts +0 -1
- package/dist/utils-invalidListGenerator.test.d.ts +0 -1
- package/dist/utils-randomLetter.test.d.ts +0 -1
- package/dist/utils-removeFromPosition.test.d.ts +0 -1
- package/dist/utils-sumElementsByMultipliers.test.d.ts +0 -1
- package/dist/utils-sumToDV.test.d.ts +0 -1
- package/dist/utils.d.ts +0 -131
- package/dist/utils.js +0 -190
- package/dist/utils.js.map +0 -1
- package/eslint.config.js +0 -82
- package/jest.config.js +0 -11
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// pix usado pelo 10 pila.
|
|
2
|
+
|
|
3
|
+
import { PixCopyPaste } from '../src/pix-copy-paste';
|
|
4
|
+
|
|
5
|
+
// esse pix é um pix automatico
|
|
6
|
+
const pixStone = `00020101021226820014br.gov.bcb.pix2560pix.stone.com.br/pix/v2/b411f5c8-e97f-4a18-af0e-fc66491748d7520400005303986540510.005802BR5925DIOGO DA SILVA SANTOS LTD6014RIO DE JANEIRO622905251e3afd7926983f8ffe086cdc16304FF60`;
|
|
7
|
+
const pixManual = `00020126550014BR.GOV.BCB.PIX0123alexandrepato@gmail.com0206almoco5204000053039865406100.005802BR5914Alexandre Pato6009Ipanguacu61085950800062490511PIXJS76657250300017BR.GOV.BCB.BRCODE01051.0.0630455CF`;
|
|
8
|
+
|
|
9
|
+
const cases = [
|
|
10
|
+
pixStone,
|
|
11
|
+
pixManual
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
describe('PixCopyPaste', () => {
|
|
16
|
+
describe('constructor', () => {
|
|
17
|
+
test.each(cases)('deve estar definido', (input) => {
|
|
18
|
+
const pix = new PixCopyPaste(input);
|
|
19
|
+
expect(pix).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('deve lançar um erro ao injetar um caractere na terceira posição', () => {
|
|
23
|
+
const copyPaste = pixStone.slice(0, 4) + 'D' + pixStone.slice(4);
|
|
24
|
+
expect(()=>new PixCopyPaste(copyPaste)).toThrow()
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('parse', () => {
|
|
29
|
+
test.each(cases)('testa o parse', (input) => {
|
|
30
|
+
const parse = PixCopyPaste.parse(input);
|
|
31
|
+
|
|
32
|
+
expect(parse).toBeDefined();
|
|
33
|
+
expect(Array.isArray(parse)).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PixKey, PixKeys } from '../src/pix-key';
|
|
2
|
+
|
|
3
|
+
describe('Pix', () => {
|
|
4
|
+
describe('constructor', () => {
|
|
5
|
+
test('deve estar definido do tipo e-mail', () => {
|
|
6
|
+
const key = new PixKey('klawdyo@gmail.com');
|
|
7
|
+
expect(key).toBeDefined();
|
|
8
|
+
expect(key.type).toBe(PixKeys.email);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('deve estar definido do tipo cpf', () => {
|
|
12
|
+
const key = new PixKey('004.129.620-63');
|
|
13
|
+
expect(key).toBeDefined();
|
|
14
|
+
expect(key.type).toBe(PixKeys.cpf);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('deve estar definido do tipo cnpj', () => {
|
|
18
|
+
const key = new PixKey('41356581000186');
|
|
19
|
+
expect(key).toBeDefined();
|
|
20
|
+
expect(key.type).toBe(PixKeys.cnpj);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('deve estar definido do tipo aleatória', () => {
|
|
24
|
+
const key = new PixKey('01234567-0123-4567-8901-234567890123');
|
|
25
|
+
expect(key).toBeDefined();
|
|
26
|
+
expect(key.type).toBe(PixKeys.evp);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('deve estar definido do tipo phone', () => {
|
|
30
|
+
const key = new PixKey('+5584987654321');
|
|
31
|
+
expect(key).toBeDefined();
|
|
32
|
+
expect(key.type).toBe(PixKeys.phone);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('deve falhar ao receber um telefone inválido', () => {
|
|
36
|
+
expect(() => new PixKey('+55849876')).toThrow()
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { PostalTrackCode } from '../src/postal-track-code';
|
|
2
|
+
|
|
3
|
+
describe('PostalTrackCode', () => {
|
|
4
|
+
describe('constructor', () => {
|
|
5
|
+
test.each([
|
|
6
|
+
'PN718252423BR',
|
|
7
|
+
'PO925539762BR',
|
|
8
|
+
'JT194690698BR',
|
|
9
|
+
'SV143851674BR',
|
|
10
|
+
'RG727348650CN',
|
|
11
|
+
'RY747622885CN',
|
|
12
|
+
'RY728187035CN',
|
|
13
|
+
'RH940629235CN',
|
|
14
|
+
'RY686586175CN',
|
|
15
|
+
'RY648001205CN',
|
|
16
|
+
'UJ776469464CN',
|
|
17
|
+
'LZ667841882CN',
|
|
18
|
+
'RS737783818NL',
|
|
19
|
+
])('%s deve estar definido', (input) => {
|
|
20
|
+
expect(new PostalTrackCode(input)).toBeDefined();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test.each([
|
|
24
|
+
'PO925524762BR', // dv inválido
|
|
25
|
+
'JT194624698BR', // dv inválido
|
|
26
|
+
'SV143824674BR', // dv inválido
|
|
27
|
+
'RG727324650CN', // dv inválido
|
|
28
|
+
'RY747624885CN', // dv inválido
|
|
29
|
+
'RY728114035CN', // dv inválido
|
|
30
|
+
'RY728114035', // sem letras no final
|
|
31
|
+
'RY728114035N', // 1 letra no final
|
|
32
|
+
'RS737783818NLL', // 3 letras no final
|
|
33
|
+
'737783818NL', // sem letra no começo
|
|
34
|
+
'S737783818NL', // só 1 letra no começo
|
|
35
|
+
'ARS737783818NL', // 3 letras no começo
|
|
36
|
+
'RS73778381NL', // numero a menos
|
|
37
|
+
null,
|
|
38
|
+
undefined,
|
|
39
|
+
])('%s deve lançar erro', (input) => {
|
|
40
|
+
expect(() => new PostalTrackCode(input as any)).toThrow();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('mask', () => {
|
|
45
|
+
test.each([
|
|
46
|
+
{ num: 'pn718252423br', expected: 'PN718252423BR' },
|
|
47
|
+
{ num: 'po925539762br', expected: 'PO925539762BR' },
|
|
48
|
+
{ num: 'jt194690698br', expected: 'JT194690698BR' },
|
|
49
|
+
])('Deve aplicar a máscara corretamente', (item) => {
|
|
50
|
+
const masked = new PostalTrackCode(item.num).mask();
|
|
51
|
+
|
|
52
|
+
expect(masked).toBe(item.expected);
|
|
53
|
+
expect(masked).toMatch(/^[A-Z]{2}\d{9}[A-Z]{2}$/);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('fake', () => {
|
|
58
|
+
test.each([...Array(5)])('deve gerar fakes válidos', () => {
|
|
59
|
+
const result = PostalTrackCode.fake();
|
|
60
|
+
expect(result).toBeDefined();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('checksum', () => {
|
|
65
|
+
test.each([
|
|
66
|
+
{ num: '71825242', expected: '3' },
|
|
67
|
+
{ num: '92553976', expected: '2' },
|
|
68
|
+
{ num: '19469069', expected: '8' },
|
|
69
|
+
])('Deve calcular o Dv corretamente', (item) => {
|
|
70
|
+
const calcDv = PostalTrackCode.checksum(item.num);
|
|
71
|
+
|
|
72
|
+
expect(calcDv).toBe(item.expected);
|
|
73
|
+
expect(typeof calcDv).toBe('string');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test.each(['PN718252423BR', '925539762BR', 'JT194690698'])(
|
|
77
|
+
'Deve lançar erro',
|
|
78
|
+
(item) => {
|
|
79
|
+
expect(() => PostalTrackCode.checksum(item)).toThrow();
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Renavam } from '../src/renavam';
|
|
2
|
+
|
|
3
|
+
describe('Renavam', () => {
|
|
4
|
+
describe('constructor', () => {
|
|
5
|
+
test.each([
|
|
6
|
+
'1952519770-3',
|
|
7
|
+
'3394038959-9',
|
|
8
|
+
'03607626105',
|
|
9
|
+
'64090416160',
|
|
10
|
+
'80499688374',
|
|
11
|
+
'40650543741',
|
|
12
|
+
])('deve estar definido', (input) => {
|
|
13
|
+
expect(new Renavam(input)).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test.each([
|
|
17
|
+
'19525227703',
|
|
18
|
+
'33940229599',
|
|
19
|
+
'03607226105',
|
|
20
|
+
'64090226160',
|
|
21
|
+
'80499228374',
|
|
22
|
+
'', // vazio
|
|
23
|
+
'012345678900', // caracteres a mais
|
|
24
|
+
'12345678', // caracteres a menos
|
|
25
|
+
null,
|
|
26
|
+
undefined,
|
|
27
|
+
])('deve lançar erro', (input) => {
|
|
28
|
+
expect(() => new Renavam(input as any)).toThrow();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('mask', () => {
|
|
33
|
+
test.each([
|
|
34
|
+
{ num: '03607626105', expected: '0360762610-5' },
|
|
35
|
+
{ num: '64090416160', expected: '6409041616-0' },
|
|
36
|
+
{ num: '80499688374', expected: '8049968837-4' },
|
|
37
|
+
])('mask() - Testando se a máscara foi gerada corretamente', (item) => {
|
|
38
|
+
const masked = new Renavam(item.num).mask();
|
|
39
|
+
|
|
40
|
+
expect(masked).toBe(item.expected);
|
|
41
|
+
expect(masked).toMatch(/^\d{10}-\d{1}$/);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('fake', () => {
|
|
46
|
+
test.each([...Array(5)])('fake() - Gera fakes sem máscara', () => {
|
|
47
|
+
const result = Renavam.fake();
|
|
48
|
+
expect(result).toBeDefined();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('checksum', () => {
|
|
53
|
+
test.each([
|
|
54
|
+
{ num: '1952519770', expected: '3' },
|
|
55
|
+
{ num: '0952519770', expected: '6' },
|
|
56
|
+
{ num: '0052519770', expected: '2' },
|
|
57
|
+
])('Deve gerar o dv correto', (item) => {
|
|
58
|
+
const calcDv = Renavam.checksum(item.num);
|
|
59
|
+
|
|
60
|
+
expect(calcDv).toBe(item.expected);
|
|
61
|
+
expect(typeof calcDv).toBe('string');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test.each(['00525197701', '0052519770-1', '005251977'])(
|
|
65
|
+
'deve lançar erro de dv',
|
|
66
|
+
(item) => {
|
|
67
|
+
expect(() => Renavam.checksum(item)).toThrow();
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { TituloEleitor } from "../src/tituloEleitor";
|
|
2
|
+
|
|
3
|
+
describe('TituloEleitor', () => {
|
|
4
|
+
describe('constructor', () => {
|
|
5
|
+
test.each([
|
|
6
|
+
// masked
|
|
7
|
+
'1023.8501.0671',
|
|
8
|
+
'8365.7137.1619',
|
|
9
|
+
// string
|
|
10
|
+
'153036161686',
|
|
11
|
+
'525028881694',
|
|
12
|
+
// integer
|
|
13
|
+
'011122223360',
|
|
14
|
+
'001122223336',
|
|
15
|
+
])('deve estar definido', (input) => {
|
|
16
|
+
expect(new TituloEleitor(input)).toBeDefined();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test.each([
|
|
20
|
+
'836531371619',
|
|
21
|
+
'743620641660',
|
|
22
|
+
'153016161686',
|
|
23
|
+
'525078881694',
|
|
24
|
+
'026367681660',
|
|
25
|
+
'558647441635',
|
|
26
|
+
'222222222222',
|
|
27
|
+
'', // vazio
|
|
28
|
+
'012345678900', // caracteres a mais
|
|
29
|
+
'12345678', // caracteres a menos
|
|
30
|
+
null,
|
|
31
|
+
undefined,
|
|
32
|
+
])('deve lançar erro', (input) => {
|
|
33
|
+
expect(() => new TituloEleitor(input as any)).toThrow();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('mask', () => {
|
|
38
|
+
test.each([
|
|
39
|
+
{ num: '102385010671', expected: '1023.8501.0671' },
|
|
40
|
+
{ num: '836571371619', expected: '8365.7137.1619' },
|
|
41
|
+
{ num: '743650641660', expected: '7436.5064.1660' },
|
|
42
|
+
{ num: '011122223360', expected: '0111.2222.3360' },
|
|
43
|
+
{ num: '001122223336', expected: '0011.2222.3336' },
|
|
44
|
+
])('mask() - Testando se a máscara foi gerada corretamente', (item) => {
|
|
45
|
+
const masked = new TituloEleitor(item.num).mask();
|
|
46
|
+
|
|
47
|
+
expect(masked).toBe(item.expected);
|
|
48
|
+
expect(masked).toMatch(/^\d{4}.\d{4}.\d{4}$/)
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('fake', () => {
|
|
53
|
+
test.each([...Array(5)])('fake() - Gera fakes sem máscara', () => {
|
|
54
|
+
const result = TituloEleitor.fake();
|
|
55
|
+
expect(result).toBeDefined();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('checksum', () => {
|
|
60
|
+
test.each([
|
|
61
|
+
{ num: '1023850106', expected: '71' },
|
|
62
|
+
{ num: '8365713716', expected: '19' },
|
|
63
|
+
{ num: '7436506416', expected: '60' },
|
|
64
|
+
{ num: '0011222233', expected: '36' },
|
|
65
|
+
])('dv() - Verificando se o DV gerado está correto', (item) => {
|
|
66
|
+
const calcDv = TituloEleitor.checksum(item.num);
|
|
67
|
+
|
|
68
|
+
expect(calcDv).toBe(item.expected);
|
|
69
|
+
expect(typeof calcDv).toBe('string');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { checkRepeatedSequence } from "../src/utils"
|
|
2
|
+
|
|
3
|
+
test.each([
|
|
4
|
+
'11111111',
|
|
5
|
+
'1111',
|
|
6
|
+
])('testa se %s tem todos os valores iguais', (value) => {
|
|
7
|
+
expect(checkRepeatedSequence(value)).toBeTruthy()
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
test.each([
|
|
11
|
+
'12345678',
|
|
12
|
+
'11111112',
|
|
13
|
+
'1234',
|
|
14
|
+
'2111',
|
|
15
|
+
])('testa se %s não tem todos os valores iguais', (value) => {
|
|
16
|
+
expect(checkRepeatedSequence(value)).toBeFalsy()
|
|
17
|
+
})
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { clearValue } from '../src/utils'
|
|
2
|
+
|
|
3
|
+
describe('clearValue()', () => {
|
|
4
|
+
test('Deve limpar o valor - Strings do Mesmo tamanho', () => {
|
|
5
|
+
//
|
|
6
|
+
const valid = [
|
|
7
|
+
{ value: 1234567890, size: 10, expected: '1234567890' },
|
|
8
|
+
{ value: '1234567890', size: 10, expected: '1234567890' },
|
|
9
|
+
{ value: '12.345.678-90', size: 10, expected: '1234567890' },
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
valid.forEach((item) => {
|
|
13
|
+
expect(clearValue(item.value, item.size)).toBe(item.expected)
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('Deve limpar os caracteres não numéricos sem verificar o tamanho da string', () => {
|
|
18
|
+
//
|
|
19
|
+
const valid = [
|
|
20
|
+
{ value: 1234567890123, size: null, expected: '1234567890123' },
|
|
21
|
+
{ value: '4567890', size: null, expected: '4567890' },
|
|
22
|
+
{ value: '345.678-90', size: null, expected: '34567890' },
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
valid.forEach((item) => {
|
|
26
|
+
expect(clearValue(item.value, item.size)).toBe(item.expected)
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('Deve limpar o valor os caracteres não numéricos e completar com zeros à esquerda', () => {
|
|
31
|
+
//
|
|
32
|
+
const valid = [
|
|
33
|
+
{ value: 1234, size: 10, expected: '0000001234' },
|
|
34
|
+
{ value: '1234', size: 10, expected: '0000001234' },
|
|
35
|
+
{ value: '123-4', size: 10, expected: '0000001234' },
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
valid.forEach((item) => {
|
|
39
|
+
expect(clearValue(item.value, item.size, { fillZerosAtLeft: true })).toBe(item.expected)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
// Não completa com zeros
|
|
43
|
+
expect(clearValue(1234, 6, { fillZerosAtLeft: false })).toBe('1234')
|
|
44
|
+
expect(clearValue('1234', 6, { fillZerosAtLeft: false })).toBe('1234')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('Deve limpar o valor os caracteres não numéricos e remover os caracteres que passarem de size', () => {
|
|
48
|
+
//
|
|
49
|
+
const valid = [
|
|
50
|
+
{ value: 123456789, size: 4, expected: '1234' },
|
|
51
|
+
{ value: '1234567890', size: 4, expected: '1234' },
|
|
52
|
+
{ value: '12.345.678-90', size: 4, expected: '1234' },
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
valid.forEach((item) => {
|
|
56
|
+
expect(clearValue(item.value, item.size, { trimAtRight: true })).toBe(item.expected)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// Não corta à direita
|
|
60
|
+
expect(clearValue(12345678, 6, { trimAtRight: false })).toBe('12345678')
|
|
61
|
+
expect(clearValue('12345678', 6, { trimAtRight: false })).toBe('12345678')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test('Deve retornar erro se receber um valor vazio', () => {
|
|
65
|
+
expect(clearValue('1112', 4, { rejectEmpty: true })).toBe('1112')
|
|
66
|
+
expect(() => clearValue('', null, { rejectEmpty: true })).toThrow()
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('Deve retornar erro se receber uma sequência de números iguais', () => {
|
|
70
|
+
expect(clearValue('1112', 4, { rejectEqualSequence: true })).toBe('1112')
|
|
71
|
+
expect(() => clearValue('1111', 4, { rejectEqualSequence: true })).toThrow()
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
test('Deve retornar erro se receber um valor com mais caracteres que o máximo', () => {
|
|
75
|
+
expect(clearValue('1234', 4, { rejectIfLonger: true })).toBe('1234')
|
|
76
|
+
expect(() => clearValue('12345', 4, { rejectIfLonger: true })).toThrow()
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test('Deve retornar o mesmo valor inicial', () => {
|
|
80
|
+
expect(clearValue(1234, 4)).toBe('1234')
|
|
81
|
+
expect(clearValue('1234', 4)).toBe('1234')
|
|
82
|
+
expect(clearValue(1234, 4, {})).toBe('1234')
|
|
83
|
+
expect(clearValue('1234', 4, {})).toBe('1234')
|
|
84
|
+
})
|
|
85
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { insertAtPosition } from '../src/utils'
|
|
2
|
+
|
|
3
|
+
describe('insertAtPosition()', () => {
|
|
4
|
+
test('Deve inserir um caractere em uma determinada posição da string', () => {
|
|
5
|
+
//
|
|
6
|
+
const list = [
|
|
7
|
+
{ value: 'AAABBB', insert: 'C', position: 3, expected: 'AAACBBB' },
|
|
8
|
+
{ value: 'J Med', insert: 'Cl ', position: 2, expected: 'J Cl Med' },
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
list.forEach((item) => {
|
|
12
|
+
expect(insertAtPosition(item.value, item.insert, item.position)).toBe(item.expected)
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { removeFromPosition } from '../src/utils'
|
|
2
|
+
|
|
3
|
+
describe('removeFromPosition()', () => {
|
|
4
|
+
test('', () => {
|
|
5
|
+
//
|
|
6
|
+
const list = [
|
|
7
|
+
{ value: 'Jossé', start: 2, end: 3, expected: 'José' },
|
|
8
|
+
{ value: 'Cláuudio', start: 4, end: 5, expected: 'Cláudio' },
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
list.forEach((item) => {
|
|
12
|
+
expect(removeFromPosition(item.value, item.start, item.end)).toBe(item.expected)
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { sumElementsByMultipliers } from '../src/utils'
|
|
2
|
+
|
|
3
|
+
describe('sumElementsByMultipliers()', () => {
|
|
4
|
+
test('Tipo do retorno', () => {
|
|
5
|
+
const sum = sumElementsByMultipliers('1234', [9, 8, 7, 6])
|
|
6
|
+
|
|
7
|
+
expect(typeof sum).toBe('number')
|
|
8
|
+
expect(sum).toBe(70)
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test.each([
|
|
12
|
+
{ input: '1234', multipliers: [9, 8, 7, 6], expected: 70 },
|
|
13
|
+
// cnpj
|
|
14
|
+
{ input: '112223330001', multipliers: [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2], expected: 102 },
|
|
15
|
+
// cpf
|
|
16
|
+
{ input: '280012389', multipliers: [10, 9, 8, 7, 6, 5, 4, 3, 2], expected: 162 },
|
|
17
|
+
{ input: '2800123893', multipliers: [11, 10, 9, 8, 7, 6, 5, 4, 3, 2], expected: 201 },
|
|
18
|
+
// titulo
|
|
19
|
+
])('Valores retornados', (item) => {
|
|
20
|
+
const sum = sumElementsByMultipliers(item.input, item.multipliers)
|
|
21
|
+
expect(sum).toBe(item.expected)
|
|
22
|
+
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { sumToDV } from '../src/utils'
|
|
2
|
+
|
|
3
|
+
describe('sumToDV()', () => {
|
|
4
|
+
test('Os resultados devem ser os esperados', () => {
|
|
5
|
+
const list = [
|
|
6
|
+
{ value: 102, expected: 8 },
|
|
7
|
+
{ value: 120, expected: 1 },
|
|
8
|
+
{ value: 162, expected: 3 },
|
|
9
|
+
{ value: 179, expected: 8 },
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
list.forEach((item) => {
|
|
13
|
+
expect(sumToDV(item.value)).toBe(item.expected)
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
})
|
package/todo.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
- [x] isCarPlate
|
|
2
|
+
|
|
3
|
+
- [x] isPhone
|
|
4
|
+
|
|
5
|
+
- https://github.com/VitorLuizC/brazilian-values/blob/master/src/validators/isPhone.ts
|
|
6
|
+
- https://github.com/VitorLuizC/brazilian-values/blob/master/src/validators/isDDD.ts
|
|
7
|
+
|
|
8
|
+
- ~~[ ] Conta bancária~~
|
|
9
|
+
|
|
10
|
+
- [x] isPixKey - verifica se é um dos tipos de chaves
|
|
11
|
+
|
|
12
|
+
- [x] isPixCopyPaste - verifica se é um dos tipos de chaves
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- [x] isCEP
|
|
16
|
+
- https://github.com/ogilvieira/validator-brasil/blob/main/src/isCEP.ts
|
|
17
|
+
- @klawdyo/qrdapio
|
|
18
|
+
|
|
19
|
+
- [x] isUF
|
|
20
|
+
- @klawdyo/qrdapio
|
|
21
|
+
|
|
22
|
+
- isBoleto
|
|
23
|
+
- Construtor pode receber linha digitável
|
|
24
|
+
- Pra receber o código de barras, use o static fromBarcode()
|
|
25
|
+
- mask() pode devolver a linha digitável ou o código de barras. Por padrão, a linha digitável
|
|
26
|
+
- toString() devolve a linha digitável
|
|
27
|
+
- toBarcode() devolve a linha digitável
|
|
28
|
+
- parse() é chamado no início e já separa as partes
|
|
29
|
+
|
|
30
|
+
- [ ] isCAEPF
|
|
31
|
+
- https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/caepf/legislacao
|
|
32
|
+
- https://github.com/VitorLuizC/brazilian-values/blob/master/src/validators/isCAEPF.ts
|
package/tsconfig.json
CHANGED
|
@@ -1,25 +1,105 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
/* Projects */
|
|
5
|
+
"incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
6
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
7
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
8
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
9
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
10
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
11
|
+
/* Language and Environment */
|
|
12
|
+
"target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
13
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
14
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
15
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
16
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
17
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
18
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
19
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
20
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
21
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
22
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
23
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
24
|
+
/* Modules */
|
|
25
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
26
|
+
// "rootDir": "./src", /* Specify the root folder within your source files. */
|
|
27
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
28
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
29
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
30
|
+
"rootDirs": [
|
|
31
|
+
"./src",
|
|
32
|
+
"./test",
|
|
33
|
+
], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
+
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
43
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
44
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
45
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
46
|
+
/* JavaScript Support */
|
|
47
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
+
/* Emit */
|
|
51
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
52
|
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
53
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
54
|
+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
55
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
56
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
57
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
59
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
61
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
62
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
63
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
64
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
65
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
66
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
67
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
68
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
69
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
70
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
71
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
72
|
+
/* Interop Constraints */
|
|
73
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
74
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
75
|
+
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
76
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
77
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
78
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
79
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
80
|
+
/* Type Checking */
|
|
81
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
82
|
+
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
83
|
+
"strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
84
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
85
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
86
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
87
|
+
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
88
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
89
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
90
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
91
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
92
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
93
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
94
|
+
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
95
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
96
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
97
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
98
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
99
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
100
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
101
|
+
/* Completeness */
|
|
102
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
103
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
104
|
+
}
|
|
105
|
+
}
|