Search docs...

Search docs...

es
v0.1 · Open source · MIT

Mexican data,
validated.

CURP, RFC, CLABE, NSS, postal codes, phone numbers and amounts in words. One tiny TypeScript library that gets the details right.

$npm i mexico-utils
Paste anything

A CURP, RFC, CLABE, NSS, postal code, phone number or amount. It figures out which one it is.

Try
CLABE002010077777777771Valid
Bank
Banamex
Bank code
002
Plaza
010
Account
07777777777

Runs in your browser. Nothing you type leaves this page.

0
dependencies
<7 KB
gzipped
100%
TypeScript
ESM + CJS
Node, browsers and edge

Everything a Mexican form needs

Each module validates, explains what's wrong, and pulls the useful data out.

Errors you can show in any language

Every check returns an error code instead of a message, so your form can say exactly what's wrong, in your words.

const result = checkCurp(input);

if (!result.ok) {
  // "format" | "date" | "state" | "check-digit"
  setError(messages[result.error]);
}

Start in a minute

Install it, import what you need, ship the form.

$npm i mexico-utils
Get started