chilean-plate-validator 0.8.0 → 0.9.0
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/LICENSE +1 -1
- package/README.md +51 -35
- package/dist/index.d.mts +33 -0
- package/dist/index.d.ts +12 -11
- package/dist/index.js +93 -59
- package/dist/index.mjs +70 -0
- package/package.json +29 -11
- package/dist/constants.d.ts +0 -15
- package/dist/constants.js +0 -34
- package/dist/constants.js.map +0 -1
- package/dist/index.js.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,60 +1,76 @@
|
|
|
1
1
|
# chilean-plate-validator
|
|
2
2
|
|
|
3
|
-
](https://packagephobia.com/result?p=chilean-plate-validator)
|
|
3
|
+

|
|
5
4
|
[](https://www.npmjs.org/package/chilean-plate-validator)
|
|
5
|
+
[](https://packagephobia.com/result?p=chilean-plate-validator)
|
|
6
6
|
[](https://npm-stat.com/charts.html?package=chilean-plate-validator)
|
|
7
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
11
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
12
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
13
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
14
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
15
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
16
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
17
|
-
[](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
## 🇨🇱 Description
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
A lightweight, zero-dependency utility to validate and identify Chilean license plates. Updated to comply with the latest 2024-2026 regulations (**Ley 21.601**).
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
### Features
|
|
14
|
+
* **Dual Build**: Native support for ESM (`import`) and CommonJS (`require`).
|
|
15
|
+
* **TypeScript Ready**: Full type definitions included.
|
|
16
|
+
* **Up to date**: Supports new formats for trailers, motorcycles, and special vehicles.
|
|
17
|
+
* **Robust**: Normalizes inputs (handles spaces and hyphens automatically).
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🚀 Installation
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
npm install chilean-plate-validator
|
|
25
|
+
```
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
---
|
|
26
28
|
|
|
27
|
-
##
|
|
29
|
+
## 🛠 Usage
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
### Using Functions
|
|
30
32
|
```typescript
|
|
31
|
-
import { plateValid } from 'chilean-plate-validator';
|
|
33
|
+
import { plateValid, plateType } from 'chilean-plate-validator';
|
|
34
|
+
|
|
35
|
+
// Standard Validation
|
|
36
|
+
plateValid('BBCC12'); // true
|
|
37
|
+
plateValid('BB-CC-12'); // true (auto-normalized)
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
plateType('
|
|
39
|
+
// Get Category
|
|
40
|
+
plateType('AA1234'); // 'OLD_PLATE'
|
|
41
|
+
plateType('Z1234'); // 'POLICE'
|
|
35
42
|
```
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
### Using the `CLPlate` Class
|
|
45
|
+
The class provides a cleaner interface and memoized results for better performance.
|
|
46
|
+
|
|
38
47
|
```typescript
|
|
39
48
|
import { CLPlate } from 'chilean-plate-validator';
|
|
40
49
|
|
|
41
|
-
const plate = new CLPlate('
|
|
50
|
+
const plate = new CLPlate('abcd11');
|
|
42
51
|
|
|
43
|
-
plate.
|
|
44
|
-
plate.type
|
|
52
|
+
if (plate.isValid) {
|
|
53
|
+
console.log(plate.type); // 'NEW_VEHICLE_PLATE'
|
|
54
|
+
console.log(plate.formatted); // 'ABCD-11'
|
|
55
|
+
}
|
|
45
56
|
```
|
|
46
57
|
|
|
47
|
-
|
|
58
|
+
---
|
|
48
59
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
## 📚 Legal Basis & Documentation
|
|
61
|
+
This module follows the official specifications from the Servicio de Registro Civil e Identificación de Chile.
|
|
62
|
+
|
|
63
|
+
- [Official Manual (Online)](https://www.registrocivil.cl/PortalOI/Manuales/ValidacionPatentes.pdf)
|
|
64
|
+
- [Local Backup (Historical Reference)](./docs/ValidacionPatentes.pdf)
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
---
|
|
54
67
|
|
|
55
|
-
|
|
68
|
+
## 📄 License
|
|
69
|
+
This project is licensed under the MIT License.
|
|
56
70
|
|
|
57
|
-
|
|
71
|
+
---
|
|
58
72
|
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
## 👤 Author
|
|
74
|
+
Gabriel Galilea
|
|
75
|
+
- GitHub: [@gabo2151](https://github.com/gabo2151)
|
|
76
|
+
- LinkedIn: [Gabriel Galilea](https://www.linkedin.com/in/gabrielgalilea)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies if the plate is valid in Chile.
|
|
3
|
+
*
|
|
4
|
+
* @param plate Plate to validate.
|
|
5
|
+
*
|
|
6
|
+
* @returns True if the plate is valid in any of the RegEx saved,
|
|
7
|
+
* false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
declare function plateValid(plate: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Get the plate type according to the RegEx associated.
|
|
12
|
+
*
|
|
13
|
+
* @param plate Plate to check the type.
|
|
14
|
+
*
|
|
15
|
+
* @returns The type according to the RegEx that matches the plate submitted.
|
|
16
|
+
*/
|
|
17
|
+
declare function plateType(plate: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Plate class... Working on this...
|
|
20
|
+
*/
|
|
21
|
+
declare class CLPlate {
|
|
22
|
+
private readonly raw;
|
|
23
|
+
readonly clean: string;
|
|
24
|
+
constructor(plate: string);
|
|
25
|
+
get isValid(): boolean;
|
|
26
|
+
get type(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Nueva funcionalidad: Formatea la patente (ej: AA1234 -> AA-1234)
|
|
29
|
+
*/
|
|
30
|
+
get formatted(): string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { CLPlate, plateType, plateValid };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @returns True if the plate is valid in any of the RegEx saved,
|
|
7
7
|
* false otherwise.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
declare function plateValid(plate: string): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Get the plate type according to the RegEx associated.
|
|
12
12
|
*
|
|
@@ -14,19 +14,20 @@ export declare function plateValid(plate: string): boolean;
|
|
|
14
14
|
*
|
|
15
15
|
* @returns The type according to the RegEx that matches the plate submitted.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
declare function plateType(plate: string): string;
|
|
18
18
|
/**
|
|
19
19
|
* Plate class... Working on this...
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
private readonly
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new Plate instance.
|
|
26
|
-
*
|
|
27
|
-
* @param plate Plate required to check validity and type
|
|
28
|
-
*/
|
|
21
|
+
declare class CLPlate {
|
|
22
|
+
private readonly raw;
|
|
23
|
+
readonly clean: string;
|
|
29
24
|
constructor(plate: string);
|
|
30
|
-
get
|
|
25
|
+
get isValid(): boolean;
|
|
31
26
|
get type(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Nueva funcionalidad: Formatea la patente (ej: AA1234 -> AA-1234)
|
|
29
|
+
*/
|
|
30
|
+
get formatted(): string;
|
|
32
31
|
}
|
|
32
|
+
|
|
33
|
+
export { CLPlate, plateType, plateValid };
|
package/dist/index.js
CHANGED
|
@@ -1,65 +1,99 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
CLPlate: () => CLPlate,
|
|
24
|
+
plateType: () => plateType,
|
|
25
|
+
plateValid: () => plateValid
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
|
|
29
|
+
// src/constants.ts
|
|
30
|
+
var REGEX_LIST = [
|
|
31
|
+
{ name: "OLD_PLATE", regex: /^(?=.{6}$)[A-Z]{2}\d{4}$/ },
|
|
32
|
+
{ name: "NEW_VEHICLE_PLATE", regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{4}[1-9]\d$/ },
|
|
33
|
+
{ name: "NEW_MOTORCYCLE_PLATE", regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{3}\d{3}$/ },
|
|
34
|
+
{ name: "TRAILER_PLATE", regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{3}\d{3}$/ },
|
|
35
|
+
{ name: "POLICE", regex: /^(?=.{5}$)[BCJMZ]\d{4}$/ },
|
|
36
|
+
{ name: "AMBULANCE", regex: /^(?=.{5}$)A\d{4}$/ }
|
|
37
|
+
];
|
|
38
|
+
var SPECIAL_PLATES = [
|
|
39
|
+
{ combination: "AG", name: "GR\xDAA" },
|
|
40
|
+
{ combination: "AP", name: "CAMIONETA_APOYO_POLICIAL" },
|
|
41
|
+
{ combination: "AT", name: "ASISTENCIA_T\xC9CNICA_PERSONAL" },
|
|
42
|
+
{ combination: "CB", name: "CARRO_BLINDADO" },
|
|
43
|
+
{ combination: "CC", name: "CUERPO_CONSULAR" },
|
|
44
|
+
{ combination: "CD", name: "CUERPO_DIPLOM\xC1TICO" },
|
|
45
|
+
{ combination: "CH", name: "C\xD3NSUL_HONORARIO" },
|
|
46
|
+
{ combination: "CR", name: "CARRO_RODANTE" },
|
|
47
|
+
{ combination: "LA", name: "CARRO_LANZA_AGUA" },
|
|
48
|
+
{ combination: "LC", name: "LANCHA" },
|
|
49
|
+
{ combination: "OI", name: "ORGANISMO_INTERNACIONAL" },
|
|
50
|
+
{ combination: "PR", name: "PATENTE_PROVISORIA" },
|
|
51
|
+
{ combination: "RP", name: "RADIOPATRULLA" },
|
|
52
|
+
{ combination: "TC", name: "TRANSPORTE_ESCUELA_CABALLER\xCDA" }
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
// src/index.ts
|
|
56
|
+
var normalize = (p) => p.replace(/[-\s]/g, "").toUpperCase();
|
|
13
57
|
function plateValid(plate) {
|
|
14
|
-
|
|
58
|
+
if (!plate) return false;
|
|
59
|
+
const clean = normalize(plate);
|
|
60
|
+
return REGEX_LIST.some((reg) => reg.regex.test(clean));
|
|
15
61
|
}
|
|
16
|
-
exports.plateValid = plateValid;
|
|
17
|
-
/**
|
|
18
|
-
* Get the plate type according to the RegEx associated.
|
|
19
|
-
*
|
|
20
|
-
* @param plate Plate to check the type.
|
|
21
|
-
*
|
|
22
|
-
* @returns The type according to the RegEx that matches the plate submitted.
|
|
23
|
-
*/
|
|
24
62
|
function plateType(plate) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
63
|
+
if (!plate) return "INVALID";
|
|
64
|
+
const clean = normalize(plate);
|
|
65
|
+
const findPlate = REGEX_LIST.find((reg) => reg.regex.test(clean));
|
|
66
|
+
if (findPlate?.name === "OLD_PLATE") {
|
|
67
|
+
const special = SPECIAL_PLATES.find((sp) => clean.startsWith(sp.combination));
|
|
68
|
+
if (special) return special.name;
|
|
69
|
+
}
|
|
70
|
+
return findPlate ? findPlate.name : "INVALID";
|
|
33
71
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
72
|
+
var CLPlate = class {
|
|
73
|
+
constructor(plate) {
|
|
74
|
+
this.raw = plate;
|
|
75
|
+
this.clean = normalize(plate);
|
|
76
|
+
}
|
|
77
|
+
get isValid() {
|
|
78
|
+
return plateValid(this.clean);
|
|
79
|
+
}
|
|
80
|
+
get type() {
|
|
81
|
+
return plateType(this.clean);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Nueva funcionalidad: Formatea la patente (ej: AA1234 -> AA-1234)
|
|
85
|
+
*/
|
|
86
|
+
get formatted() {
|
|
87
|
+
if (!this.isValid) return this.clean;
|
|
88
|
+
if (this.clean.length === 6) {
|
|
89
|
+
return `${this.clean.slice(0, 2)}-${this.clean.slice(2)}`;
|
|
47
90
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return this.plateType;
|
|
58
|
-
},
|
|
59
|
-
enumerable: false,
|
|
60
|
-
configurable: true
|
|
61
|
-
});
|
|
62
|
-
return CLPlate;
|
|
63
|
-
}());
|
|
64
|
-
exports.CLPlate = CLPlate;
|
|
65
|
-
//# sourceMappingURL=index.js.map
|
|
91
|
+
return this.clean;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
CLPlate,
|
|
97
|
+
plateType,
|
|
98
|
+
plateValid
|
|
99
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/constants.ts
|
|
2
|
+
var REGEX_LIST = [
|
|
3
|
+
{ name: "OLD_PLATE", regex: /^(?=.{6}$)[A-Z]{2}\d{4}$/ },
|
|
4
|
+
{ name: "NEW_VEHICLE_PLATE", regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{4}[1-9]\d$/ },
|
|
5
|
+
{ name: "NEW_MOTORCYCLE_PLATE", regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{3}\d{3}$/ },
|
|
6
|
+
{ name: "TRAILER_PLATE", regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{3}\d{3}$/ },
|
|
7
|
+
{ name: "POLICE", regex: /^(?=.{5}$)[BCJMZ]\d{4}$/ },
|
|
8
|
+
{ name: "AMBULANCE", regex: /^(?=.{5}$)A\d{4}$/ }
|
|
9
|
+
];
|
|
10
|
+
var SPECIAL_PLATES = [
|
|
11
|
+
{ combination: "AG", name: "GR\xDAA" },
|
|
12
|
+
{ combination: "AP", name: "CAMIONETA_APOYO_POLICIAL" },
|
|
13
|
+
{ combination: "AT", name: "ASISTENCIA_T\xC9CNICA_PERSONAL" },
|
|
14
|
+
{ combination: "CB", name: "CARRO_BLINDADO" },
|
|
15
|
+
{ combination: "CC", name: "CUERPO_CONSULAR" },
|
|
16
|
+
{ combination: "CD", name: "CUERPO_DIPLOM\xC1TICO" },
|
|
17
|
+
{ combination: "CH", name: "C\xD3NSUL_HONORARIO" },
|
|
18
|
+
{ combination: "CR", name: "CARRO_RODANTE" },
|
|
19
|
+
{ combination: "LA", name: "CARRO_LANZA_AGUA" },
|
|
20
|
+
{ combination: "LC", name: "LANCHA" },
|
|
21
|
+
{ combination: "OI", name: "ORGANISMO_INTERNACIONAL" },
|
|
22
|
+
{ combination: "PR", name: "PATENTE_PROVISORIA" },
|
|
23
|
+
{ combination: "RP", name: "RADIOPATRULLA" },
|
|
24
|
+
{ combination: "TC", name: "TRANSPORTE_ESCUELA_CABALLER\xCDA" }
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
// src/index.ts
|
|
28
|
+
var normalize = (p) => p.replace(/[-\s]/g, "").toUpperCase();
|
|
29
|
+
function plateValid(plate) {
|
|
30
|
+
if (!plate) return false;
|
|
31
|
+
const clean = normalize(plate);
|
|
32
|
+
return REGEX_LIST.some((reg) => reg.regex.test(clean));
|
|
33
|
+
}
|
|
34
|
+
function plateType(plate) {
|
|
35
|
+
if (!plate) return "INVALID";
|
|
36
|
+
const clean = normalize(plate);
|
|
37
|
+
const findPlate = REGEX_LIST.find((reg) => reg.regex.test(clean));
|
|
38
|
+
if (findPlate?.name === "OLD_PLATE") {
|
|
39
|
+
const special = SPECIAL_PLATES.find((sp) => clean.startsWith(sp.combination));
|
|
40
|
+
if (special) return special.name;
|
|
41
|
+
}
|
|
42
|
+
return findPlate ? findPlate.name : "INVALID";
|
|
43
|
+
}
|
|
44
|
+
var CLPlate = class {
|
|
45
|
+
constructor(plate) {
|
|
46
|
+
this.raw = plate;
|
|
47
|
+
this.clean = normalize(plate);
|
|
48
|
+
}
|
|
49
|
+
get isValid() {
|
|
50
|
+
return plateValid(this.clean);
|
|
51
|
+
}
|
|
52
|
+
get type() {
|
|
53
|
+
return plateType(this.clean);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Nueva funcionalidad: Formatea la patente (ej: AA1234 -> AA-1234)
|
|
57
|
+
*/
|
|
58
|
+
get formatted() {
|
|
59
|
+
if (!this.isValid) return this.clean;
|
|
60
|
+
if (this.clean.length === 6) {
|
|
61
|
+
return `${this.clean.slice(0, 2)}-${this.clean.slice(2)}`;
|
|
62
|
+
}
|
|
63
|
+
return this.clean;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
CLPlate,
|
|
68
|
+
plateType,
|
|
69
|
+
plateValid
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chilean-plate-validator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Simple chilean plate validator",
|
|
5
5
|
"author": "Gabriel Galilea",
|
|
6
|
-
"license": "MIT
|
|
6
|
+
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
-
"
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
9
17
|
"scripts": {
|
|
10
|
-
"build": "
|
|
11
|
-
"
|
|
12
|
-
"test": "jest
|
|
18
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean --target es2020",
|
|
19
|
+
"dev": "tsup src/index.ts --watch --dts --target es2020",
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"test:watch": "jest --watchAll"
|
|
13
22
|
},
|
|
14
23
|
"repository": {
|
|
15
24
|
"type": "git",
|
|
@@ -23,10 +32,19 @@
|
|
|
23
32
|
"validar"
|
|
24
33
|
],
|
|
25
34
|
"devDependencies": {
|
|
26
|
-
"@types/jest": "
|
|
27
|
-
"jest": "
|
|
28
|
-
"jest-sonar-reporter": "
|
|
29
|
-
"ts-jest": "
|
|
30
|
-
"
|
|
35
|
+
"@types/jest": "~30.0.0",
|
|
36
|
+
"jest": "~30.3.0",
|
|
37
|
+
"jest-sonar-reporter": "~2.0.0",
|
|
38
|
+
"ts-jest": "~29.4.9",
|
|
39
|
+
"tsup": "~8.5.1",
|
|
40
|
+
"typescript": "~6.0.2"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=16.0.0"
|
|
31
49
|
}
|
|
32
50
|
}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RegExes build by chilean civil registration specifications.<br>
|
|
3
|
-
* [«Instructivo para Validación de Patentes - Servicio de Registro Civil e Identificación»](https://www.registrocivil.cl/PortalOI/Manuales/ValidacionPatentes.pdf)
|
|
4
|
-
*/
|
|
5
|
-
export declare const REGEX_LIST: {
|
|
6
|
-
name: string;
|
|
7
|
-
regex: RegExp;
|
|
8
|
-
}[];
|
|
9
|
-
/**
|
|
10
|
-
* Source [Wikipedia: Matrículas automovilísticas de Chile](https://es.wikipedia.org/wiki/Matrículas_automovilísticas_de_Chile)
|
|
11
|
-
*/
|
|
12
|
-
export declare const SPECIAL_PLATES: {
|
|
13
|
-
combination: string;
|
|
14
|
-
name: string;
|
|
15
|
-
}[];
|
package/dist/constants.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SPECIAL_PLATES = exports.REGEX_LIST = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* RegExes build by chilean civil registration specifications.<br>
|
|
6
|
-
* [«Instructivo para Validación de Patentes - Servicio de Registro Civil e Identificación»](https://www.registrocivil.cl/PortalOI/Manuales/ValidacionPatentes.pdf)
|
|
7
|
-
*/
|
|
8
|
-
exports.REGEX_LIST = [
|
|
9
|
-
{ name: 'OLD_PLATE', regex: /^(?=.{6}$)[A-Z]{2}\d{4}[^s]*$/ },
|
|
10
|
-
{ name: 'NEW_VEHICLE_PLATE', regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{4}[1-9]\d[^s]*$/ },
|
|
11
|
-
{ name: 'NEW_MOTORCYCLE_PLATE', regex: /^(?=.{6}$)[B-DF-HJ-LPR-TV-Z]{3}\d{3}[^s]*$/ },
|
|
12
|
-
{ name: 'POLICE', regex: /^(?=.{5}$)[BCJMZ]\d{4}[^s]*$/ },
|
|
13
|
-
{ name: 'AMBULANCE', regex: /^(?=.{5}$)A\d{4}[^s]*$/ },
|
|
14
|
-
];
|
|
15
|
-
/**
|
|
16
|
-
* Source [Wikipedia: Matrículas automovilísticas de Chile](https://es.wikipedia.org/wiki/Matrículas_automovilísticas_de_Chile)
|
|
17
|
-
*/
|
|
18
|
-
exports.SPECIAL_PLATES = [
|
|
19
|
-
{ combination: 'AG', name: 'GRÚA' },
|
|
20
|
-
{ combination: 'AP', name: 'CAMIONETA_APOYO_POLICIAL' },
|
|
21
|
-
{ combination: 'AT', name: 'ASISTENCIA_TÉCNICA_PERSONAL' },
|
|
22
|
-
{ combination: 'CB', name: 'CARRO_BLINDADO' },
|
|
23
|
-
{ combination: 'CC', name: 'CUERPO_CONSULAR' },
|
|
24
|
-
{ combination: 'CD', name: 'CUERPO_DIPLOMÁTICO' },
|
|
25
|
-
{ combination: 'CH', name: 'CÓNSUL_HONORARIO' },
|
|
26
|
-
{ combination: 'CR', name: 'CARRO_RODANTE' },
|
|
27
|
-
{ combination: 'LA', name: 'CARRO_LANZA_AGUA' },
|
|
28
|
-
{ combination: 'LC', name: 'LANCHA' },
|
|
29
|
-
{ combination: 'OI', name: 'ORGANISMO_INTERNACIONAL' },
|
|
30
|
-
{ combination: 'PR', name: 'PATENTE_PROVISORIA' },
|
|
31
|
-
{ combination: 'RP', name: 'RADIOPATRULLA' },
|
|
32
|
-
{ combination: 'TC', name: 'TRANSPORTE_ESCUELA_CABALLERÍA' }
|
|
33
|
-
];
|
|
34
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,+BAA+B,EAAE;IAC7D,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,8CAA8C,EAAE;IACpF,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,4CAA4C,EAAE;IACrF,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,8BAA8B,EAAE;IACzD,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,wBAAwB,EAAE;CACvD,CAAA;AAED;;GAEG;AACU,QAAA,cAAc,GAAG;IAC5B,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;IACnC,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,0BAA0B,EAAE;IACvD,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,6BAA6B,EAAE;IAC1D,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAC7C,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC9C,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB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