Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
26 changes: 26 additions & 0 deletions llms.txt
Original file line number Diff line number Diff line change
@@ -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
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -24,7 +33,8 @@
"url": "git+https://github.com/bayasdev/validator-ec.git"
},
"files": [
"dist"
"dist",
"llms.txt"
],
"type": "module",
"sideEffects": false,
Expand Down
Loading