soff-id 0.2.0 → 0.2.1
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/README.md +36 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/bledxs/soff-monorepo/master/assets/logo.png" alt="Soff Logo" width="100" height="100">
|
|
3
|
+
<h1>Soff ID</h1>
|
|
4
|
+
<p>LATAM document validation library - Validate NIT, RUT, CPF, CUIT, and more.</p>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
2
8
|
|
|
3
9
|
[](https://www.npmjs.com/package/soff-id)
|
|
4
10
|
[](LICENSE)
|
|
@@ -6,7 +12,9 @@
|
|
|
6
12
|
[](https://codecov.io/gh/bledxs/soff-monorepo)
|
|
7
13
|
[](https://bundlephobia.com/package/soff-id)
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
10
18
|
|
|
11
19
|
**Zero dependencies** · **TypeScript** · **~1KB per locale**
|
|
12
20
|
|
|
@@ -29,31 +37,49 @@ LATAM document validation library - Validate NIT, RUT, CPF, CUIT, and more.
|
|
|
29
37
|
- [License](#license)
|
|
30
38
|
- [Documentation](#documentation)
|
|
31
39
|
|
|
32
|
-
## Why?
|
|
40
|
+
## 🤔 Why?
|
|
41
|
+
|
|
42
|
+
Validating identity documents in LATAM is something **every developer** in the region has to implement:
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
| Country | Documents | Complexity |
|
|
45
|
+
| ------------ | --------------- | ------------------------ |
|
|
46
|
+
| 🇨🇴 Colombia | NIT, CC, CE, TI | ✅ Check digit algorithm |
|
|
47
|
+
| 🇧🇷 Brasil | CPF, CNPJ | ✅ Two check digits |
|
|
48
|
+
| 🇦🇷 Argentina | DNI, CUIT, CUIL | ✅ Modulus 11 |
|
|
49
|
+
| 🇨🇱 Chile | RUT, RUN | ✅ Check digit with 'K' |
|
|
50
|
+
| 🇲🇽 México | RFC, CURP | ✅ Complex validation |
|
|
35
51
|
|
|
36
|
-
This library provides a modular, tree-shakeable
|
|
52
|
+
This library provides **official algorithms** in a modular, tree-shakeable way. Import only what you need! 🌳
|
|
37
53
|
|
|
38
|
-
## Install
|
|
54
|
+
## 📦 Install
|
|
39
55
|
|
|
40
56
|
```bash
|
|
57
|
+
# npm
|
|
41
58
|
npm install soff-id
|
|
59
|
+
|
|
60
|
+
# pnpm
|
|
61
|
+
pnpm add soff-id
|
|
62
|
+
|
|
63
|
+
# yarn
|
|
64
|
+
yarn add soff-id
|
|
65
|
+
|
|
66
|
+
# bun
|
|
67
|
+
bun add soff-id
|
|
42
68
|
```
|
|
43
69
|
|
|
44
|
-
## Quick Start
|
|
70
|
+
## 🚀 Quick Start
|
|
45
71
|
|
|
46
72
|
```typescript
|
|
47
73
|
// Only Colombia included in bundle (~1KB)
|
|
48
74
|
import { validateNIT, formatNIT, calculateNITCheckDigit } from 'soff-id/locales/co';
|
|
49
75
|
|
|
50
|
-
// Validate NIT
|
|
76
|
+
// ✅ Validate NIT
|
|
51
77
|
validateNIT('900123456-7'); // → true
|
|
52
78
|
|
|
53
|
-
// Calculate check digit
|
|
79
|
+
// 🧠 Calculate check digit
|
|
54
80
|
calculateNITCheckDigit('900123456'); // → '7'
|
|
55
81
|
|
|
56
|
-
// Format NIT
|
|
82
|
+
// 🎨 Format NIT
|
|
57
83
|
formatNIT('9001234567'); // → '900.123.456-7'
|
|
58
84
|
```
|
|
59
85
|
|