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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Gabriel Galilea
3
+ Copyright (c) 2022 - 2026 Gabriel Galilea
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,60 +1,76 @@
1
1
  # chilean-plate-validator
2
2
 
3
- ![Ridiculous badge, I wanted a shield too](https://img.shields.io/badge/sabrosura-extrema-brightgreen)
4
- [![install size](https://packagephobia.com/badge?p=chilean-plate-validator)](https://packagephobia.com/result?p=chilean-plate-validator)
3
+ ![Sabrosura Extrema](https://img.shields.io/badge/sabrosura-extrema-brightgreen)
5
4
  [![npm version](https://img.shields.io/npm/v/chilean-plate-validator)](https://www.npmjs.org/package/chilean-plate-validator)
5
+ [![install size](https://packagephobia.com/badge?p=chilean-plate-validator)](https://packagephobia.com/result?p=chilean-plate-validator)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/chilean-plate-validator)](https://npm-stat.com/charts.html?package=chilean-plate-validator)
7
- [![Known Vulnerabilities](https://snyk.io/test/npm/chilean-plate-validator/badge.svg)](https://snyk.io/test/npm/chilean-plate-validator)
8
- [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
9
- [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
10
- [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
11
- [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
12
- [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=coverage)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
13
- [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
14
- [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
15
- [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
16
- [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
17
- [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=gabo2151_chilean-plate-validator&metric=bugs)](https://sonarcloud.io/summary/new_code?id=gabo2151_chilean-plate-validator)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## 🇨🇱 Description
18
10
 
19
- ## Description
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
- This module will help you to verify if a chilean registration plate is valid (doesn't calculate the check digit).
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
- The RegExes built in, follow the chilean civil registration specifications.
19
+ ---
20
+
21
+ ## 🚀 Installation
22
+
23
+ ```shell
24
+ npm install chilean-plate-validator
25
+ ```
24
26
 
25
- [«Instructivo para Validación de Patentes - Servicio de Registro Civil e Identificación»](https://www.registrocivil.cl/PortalOI/Manuales/ValidacionPatentes.pdf)
27
+ ---
26
28
 
27
- ## Code Example
29
+ ## 🛠 Usage
28
30
 
29
- #### Example 1:
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
- plateValid('BBCC12'); // returns true
34
- plateType('BBCC12'); // returns 'NEW_VEHICLE_PLATE'
39
+ // Get Category
40
+ plateType('AA1234'); // 'OLD_PLATE'
41
+ plateType('Z1234'); // 'POLICE'
35
42
  ```
36
43
 
37
- #### Example 2:
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('BBCC12');
50
+ const plate = new CLPlate('abcd11');
42
51
 
43
- plate.valid // returns true
44
- plate.type // returns 'NEW_VEHICLE_PLATE'
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
- ## Installation
58
+ ---
48
59
 
49
- ```shell
50
- $ npm i chilean-plate-validator --save
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
- ## License
66
+ ---
54
67
 
55
- [MIT License](https://github.com/gabo2151/chilean-plate-validator/blob/main/LICENSE)
68
+ ## 📄 License
69
+ This project is licensed under the MIT License.
56
70
 
57
- ## Author
71
+ ---
58
72
 
59
- - GitHub: [Gabo2151](https://github.com/gabo2151)
60
- - Twitter: [gabriel_galilea](https://twitter.com/gabriel_galilea)
73
+ ## 👤 Author
74
+ Gabriel Galilea
75
+ - GitHub: [@gabo2151](https://github.com/gabo2151)
76
+ - LinkedIn: [Gabriel Galilea](https://www.linkedin.com/in/gabrielgalilea)
@@ -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
- export declare function plateValid(plate: string): boolean;
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
- export declare function plateType(plate: string): string;
17
+ declare function plateType(plate: string): string;
18
18
  /**
19
19
  * Plate class... Working on this...
20
20
  */
21
- export declare class CLPlate {
22
- private readonly validState;
23
- private readonly plateType;
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 valid(): boolean;
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(exports, "__esModule", { value: true });
3
- exports.CLPlate = exports.plateType = exports.plateValid = void 0;
4
- var constants_1 = require("./constants");
5
- /**
6
- * Verifies if the plate is valid in Chile.
7
- *
8
- * @param plate Plate to validate.
9
- *
10
- * @returns True if the plate is valid in any of the RegEx saved,
11
- * false otherwise.
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
- return !!constants_1.REGEX_LIST.find(function (reg) { return reg.regex.test(plate.toUpperCase()); });
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
- var _plate = plate.toUpperCase();
26
- var findPlate = constants_1.REGEX_LIST.find(function (reg) { return reg.regex.test(_plate); });
27
- if ((findPlate === null || findPlate === void 0 ? void 0 : findPlate.name) === 'OLD_PLATE') {
28
- var specialPlate = constants_1.SPECIAL_PLATES.find(function (sp) { return _plate.indexOf(sp.combination) > -1; });
29
- if (!!specialPlate)
30
- return specialPlate.name;
31
- }
32
- return (findPlate ? findPlate.name : 'INVALID');
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
- exports.plateType = plateType;
35
- /**
36
- * Plate class... Working on this...
37
- */
38
- var CLPlate = /** @class */ (function () {
39
- /**
40
- * Creates a new Plate instance.
41
- *
42
- * @param plate Plate required to check validity and type
43
- */
44
- function CLPlate(plate) {
45
- this.validState = plateValid(plate);
46
- this.plateType = plateType(plate);
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
- Object.defineProperty(CLPlate.prototype, "valid", {
49
- get: function () {
50
- return this.validState;
51
- },
52
- enumerable: false,
53
- configurable: true
54
- });
55
- Object.defineProperty(CLPlate.prototype, "type", {
56
- get: function () {
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.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Simple chilean plate validator",
5
5
  "author": "Gabriel Galilea",
6
- "license": "MIT License",
6
+ "license": "MIT",
7
7
  "main": "dist/index.js",
8
- "typings": "dist/index.d.ts",
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": "tsc",
11
- "prepack": "tsc",
12
- "test": "jest --coverage"
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": "^28.1.4",
27
- "jest": "^28.1.2",
28
- "jest-sonar-reporter": "^2.0.0",
29
- "ts-jest": "^28.0.5",
30
- "typescript": "^4.7.4"
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
  }
@@ -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
@@ -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,EAAE;IACjD,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC/C,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE;IAC5C,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC/C,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;IACrC,EAAE,WAAW,EAAE,IAAI,EAAE,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