soff-id 0.2.0 → 0.2.2
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 +11 -7
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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soff-id",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "LATAM document validation library - Validate NIT, RUT, CPF, CUIT, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"dev": "tsup --watch",
|
|
88
88
|
"test": "vitest run",
|
|
89
89
|
"test:watch": "vitest",
|
|
90
|
-
"test:coverage": "vitest --coverage",
|
|
90
|
+
"test:coverage": "vitest run --coverage",
|
|
91
91
|
"type-check": "tsc --noEmit",
|
|
92
92
|
"lint": "eslint .",
|
|
93
93
|
"lint:fix": "eslint . --fix",
|
|
@@ -142,15 +142,19 @@
|
|
|
142
142
|
"devDependencies": {
|
|
143
143
|
"@eslint/js": "^9.39.1",
|
|
144
144
|
"@soff/tsconfig": "*",
|
|
145
|
-
"@vitest/coverage-v8": "^4.0.
|
|
145
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
146
146
|
"eslint": "^9.39.1",
|
|
147
147
|
"eslint-config-prettier": "^10.1.8",
|
|
148
148
|
"globals": "^16.5.0",
|
|
149
|
-
"prettier": "^3.7.
|
|
150
|
-
"rimraf": "^6.
|
|
149
|
+
"prettier": "^3.7.4",
|
|
150
|
+
"rimraf": "^6.1.2",
|
|
151
151
|
"tsup": "^8.5.1",
|
|
152
152
|
"typescript": "^5.9.3",
|
|
153
|
-
"typescript-eslint": "^8.
|
|
154
|
-
"vitest": "^4.0.
|
|
153
|
+
"typescript-eslint": "^8.49.0",
|
|
154
|
+
"vitest": "^4.0.15"
|
|
155
|
+
},
|
|
156
|
+
"publishConfig": {
|
|
157
|
+
"access": "public",
|
|
158
|
+
"provenance": true
|
|
155
159
|
}
|
|
156
160
|
}
|