diff --git a/README.md b/README.md index 87c1b3b..4d3b68f 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,20 @@ Las pruebas son propiedades con [Hegel](https://hegel.dev/) contra un oráculo e Para publicar, sube una etiqueta `vX.Y.Z` que coincida con `package.json`: GitHub Actions publica en npm con la publicación de confianza, sin tokens. +## In English + +validator-ec validates Ecuadorian cédulas, RUCs (tax IDs) and postal codes with the rules Ecuador's tax authority, the SRI, publishes. It has no dependencies and ships its own types. + +```typescript +import { isCedula, isRUC, parseIdentification } from "validator-ec"; + +isCedula("1710034065"); // true +isRUC("1790016919001"); // true +parseIdentification("1710034060"); // { ok: false, reason: "digito_verificador" } +``` + +Function names are English; the values they return use the SRI's Spanish terms (`"persona_natural"`, `"digito_verificador"`), so they match the SRI's own documents. The API reference above applies as written. + ## Licencia [Apache 2.0](https://github.com/bayasdev/validator-ec/blob/main/LICENSE). La lista de códigos postales con que se prueba `isZipCode` (`tests/data`) es de [GeoNames](https://www.geonames.org/), bajo [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). diff --git a/llms.txt b/llms.txt new file mode 100644 index 0000000..88c3384 --- /dev/null +++ b/llms.txt @@ -0,0 +1,26 @@ +# validator-ec + +> Validates Ecuadorian identification numbers (cédula, RUC, consumidor final) and postal codes with the rules Ecuador's tax authority (SRI) publishes. TypeScript, zero dependencies, ES module for Node.js 22.12 or later. `parseIdentification` says what a value is or why it is invalid; every other function wraps it. + +Install with `npm install validator-ec`. Function names are English; returned values use the SRI's Spanish terms. + +```ts +import { isCedula, isRUC, parseIdentification } from "validator-ec"; + +isCedula("1710034065"); // true +isRUC("1790016919001"); // true +parseIdentification("1710034060"); // { ok: false, reason: "digito_verificador" } +``` + +Rules worth knowing before using it: + +- A cédula is 10 digits: province 01 to 24 or 30, third digit 0 to 5, and a modulo 10 check digit. +- A RUC is 13 digits ending in 001. A natural person's RUC is their cédula plus 001. Public (third digit 6) and private or foreign (third digit 9) RUCs are checked by shape only, because the SRI no longer guarantees their modulo 11 digit. +- 9999999999999 is the consumidor final, not a RUC. +- isZipCode checks the shape of a postal code only; it cannot tell whether a code exists. + +## Docs + +- [README](https://github.com/bayasdev/validator-ec/blob/main/README.md): the full API, with an example for every function and the sources behind each rule (Spanish, with an English quick start) +- [CHANGELOG](https://github.com/bayasdev/validator-ec/blob/main/CHANGELOG.md): what changed in each version and how to migrate from 1.x to 2.x +- [Type declarations](https://unpkg.com/validator-ec/dist/index.d.ts): every export with its documentation comment diff --git a/package.json b/package.json index 1d9b66f..2798643 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,25 @@ { "name": "validator-ec", "version": "2.0.0", - "description": "Validadores de cédula, RUC y código postal ecuatorianos, según las reglas que publica el SRI.", + "description": "Validar cédula y RUC de Ecuador según el SRI, y saber por qué fallan. Validate Ecuadorian cédula (cedula) and RUC numbers. TypeScript, sin dependencias.", "keywords": [ "cedula", - "ci", + "cedula ecuador", + "cedula ecuatoriana", + "codigo postal", "consumidor final", + "cédula", "ecuador", - "identidad", + "ecuador id", + "identificacion", "ruc", + "ruc ecuador", "sri", + "tax id", + "typescript", "validador", + "validar cedula", + "validar ruc", "validator" ], "homepage": "https://github.com/bayasdev/validator-ec#readme", @@ -24,7 +33,8 @@ "url": "git+https://github.com/bayasdev/validator-ec.git" }, "files": [ - "dist" + "dist", + "llms.txt" ], "type": "module", "sideEffects": false,