Skip to content

Commit aae04cd

Browse files
committed
1.0.17 version!
1 parent 9cca19d commit aae04cd

6 files changed

Lines changed: 114 additions & 92 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: [pedroelhumano]
3+
github: [wotanCode]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
# Folders
12
/node_modules
23
/dist-browser
34
/dist-node
45
/dist
56
/coverage
7+
8+
# Files
69
package-lock.json
10+
11+
# OS Files
12+
.DS_Store

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ eslint.config.mjs
1313
package-lock.json
1414
.prettierrc
1515

16+
# OS Files
17+
.DS_Store
18+
1619
# Include
1720
!dist

README.md

Lines changed: 91 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -25,95 +25,99 @@ const { format, calculateDv, isValidRut, isFormat } = require('rutility');
2525
import { format, calculateDv, isValidRut, isFormat } from 'rutility';
2626
```
2727
28-
## Formatting Functions
29-
`format.dot(rut: string): string`
30-
Formats a RUT by adding dots.
31-
32-
```javascript
33-
console.log(format.dot('12345678')); // '12.345.678'
34-
console.log(format.dot('12345678-K')); // '12.345.678-K'
35-
```
36-
37-
`format.dash(rut: string): string`
38-
Formats a RUT by adding a dash.
39-
40-
```javascript
41-
console.log(format.dash('123456780')); // '12345678-0'
42-
console.log(format.dash('12.345.6780')); // '12.345.678-0'
43-
console.log(format.dash('12')); // '1-2'
44-
```
45-
46-
`format.dotDash(rut: string): string`
47-
Formats a RUT by adding dots and a dash.
48-
49-
```javascript
50-
console.log(format.dotDash('123456780')); // '12.345.678-0'
51-
console.log(format.dotDash('12345678-K')); // '12.345.678-K'
52-
```
53-
54-
`format.notDot(rut: string): string`
55-
Removes dots from a RUT.
56-
57-
```javascript
58-
console.log(format.notDot('12.345.678-0')); // '12345678-0'
59-
console.log(format.notDot('12.345.678')); // '12345678'
60-
```
61-
62-
`format.notDash(rut: string): string`
63-
Removes the dash and check digit from a RUT.
64-
65-
```javascript
66-
console.log(format.notDash('12.345.678-0')); // '12.345.678'
67-
console.log(format.notDash('12345678-0')); // '12345678'
68-
```
69-
70-
`format.notDotDash(rut: string): string`
71-
Removes dots and the dash from a RUT.
72-
73-
```javascript
74-
console.log(format.notDotDash('12.345.678-9')); // '12345678'
75-
console.log(format.notDotDash('12.345.678')); // '12345678'
76-
```
77-
78-
## Validation Functions
79-
`calculateDv(rut: string | number): string`
80-
Calculates the check digit of a Chilean RUT.
81-
82-
```javascript
83-
console.log(calculateDv('12.345.678')); // '5'
84-
console.log(calculateDv('12345678')); // '5'
85-
console.log(calculateDv(12345678)); // '5'
86-
```
87-
88-
`isValidRut(rut: string): boolean`
89-
Validates if a Chilean RUT is valid.
90-
91-
```javascript
92-
console.log(isValidRut('12.345.678-5')); // true
93-
console.log(isValidRut('12345678-5')); // true
94-
```
28+
### Formatting Functions
29+
<table border="1">
30+
<thead>
31+
<tr>
32+
<th>Function</th>
33+
<th>Description</th>
34+
<th>Example</th>
35+
</tr>
36+
</thead>
37+
<tbody>
38+
<tr>
39+
<td><code>format.dot(rut: string): string</code></td>
40+
<td>Formats a RUT by adding dots.</td>
41+
<td><code>console.log(format.dot('12345678')); // '12.345.678'</code></td>
42+
</tr>
43+
<tr>
44+
<td><code>format.dash(rut: string): string</code></td>
45+
<td>Formats a RUT by adding a dash.</td>
46+
<td><code>console.log(format.dash('123456780')); // '12345678-0'</code></td>
47+
</tr>
48+
<tr>
49+
<td><code>format.dotDash(rut: string): string</code></td>
50+
<td>Formats a RUT by adding dots and a dash.</td>
51+
<td><code>console.log(format.dotDash('123456780')); // '12.345.678-0'</code></td>
52+
</tr>
53+
<tr>
54+
<td><code>format.notDot(rut: string): string</code></td>
55+
<td>Removes dots from a RUT.</td>
56+
<td><code>console.log(format.notDot('12.345.678-0')); // '12345678-0'</code></td>
57+
</tr>
58+
<tr>
59+
<td><code>format.notDash(rut: string): string</code></td>
60+
<td>Removes the dash and check digit from a RUT.</td>
61+
<td><code>console.log(format.notDash('12.345.678-0')); // '12.345.678'</code></td>
62+
</tr>
63+
<tr>
64+
<td><code>format.notDotDash(rut: string): string</code></td>
65+
<td>Removes dots and the dash from a RUT.</td>
66+
<td><code>console.log(format.notDotDash('12.345.678-9')); // '12345678'</code></td>
67+
</tr>
68+
</tbody>
69+
</table>
70+
71+
### Validation Functions
72+
<table border="1">
73+
<thead>
74+
<tr>
75+
<th>Function</th>
76+
<th>Description</th>
77+
<th>Example</th>
78+
</tr>
79+
</thead>
80+
<tbody>
81+
<tr>
82+
<td><code>calculateDv(rut: string | number): string</code></td>
83+
<td>Calculates the check digit of a Chilean RUT.</td>
84+
<td><code>console.log(calculateDv('12.345.678')); // '5'</code></td>
85+
</tr>
86+
<tr>
87+
<td><code>isValidRut(rut: string): boolean</code></td>
88+
<td>Validates if a Chilean RUT is valid.</td>
89+
<td><code>console.log(isValidRut('12.345.678-5')); // true</code></td>
90+
</tr>
91+
</tbody>
92+
</table>
9593
9694
### Format Validations
97-
`isFormat.dot(rut: string): boolean`
98-
Checks if a RUT has the correct format with dots.
99-
100-
``` javascript
101-
console.log(isFormat.dot('12.345.678')); // true
102-
```
103-
104-
isFormat.dash(rut: string): boolean
105-
Checks if a RUT has the correct format with a dash.
106-
107-
``` javascript
108-
console.log(isFormat.dash('12345678-9')); // true
109-
```
110-
111-
`isFormat.dotDash(rut: string): boolean`
112-
Checks if a RUT has the correct format with dots and a dash.
113-
114-
```javascript
115-
console.log(isFormat.dotDash('12.345.678-9')); // true
116-
```
95+
<table border="1">
96+
<thead>
97+
<tr>
98+
<th>Function</th>
99+
<th>Description</th>
100+
<th>Example</th>
101+
</tr>
102+
</thead>
103+
<tbody>
104+
<tr>
105+
<td><code>isFormat.dot(rut: string): boolean</code></td>
106+
<td>Checks if a RUT has the correct format with dots.</td>
107+
<td><code>console.log(isFormat.dot('12.345.678')); // true</code></td>
108+
</tr>
109+
<tr>
110+
<td><code>isFormat.dash(rut: string): boolean</code></td>
111+
<td>Checks if a RUT has the correct format with a dash.</td>
112+
<td><code>console.log(isFormat.dash('12345678-9')); // true</code></td>
113+
</tr>
114+
<tr>
115+
<td><code>isFormat.dotDash(rut: string): boolean</code></td>
116+
<td>Checks if a RUT has the correct format with dots and a dash.</td>
117+
<td><code>console.log(isFormat.dotDash('12.345.678-9')); // true</code></td>
118+
</tr>
119+
</tbody>
120+
</table>
117121
118122
## Contributing
119123
If you wish to contribute to this project, please open an issue or submit a pull request.

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 1.0.17 Better documentation
2+
- Add `public-npm` script in `package.json`.
3+
- Update `.gitignore` and `npmignore`.
4+
- Update `FUNDING.yml`.
5+
- Update `README.md`.
6+
17
### 1.0.16 Fix build compilation
28

39
### 1.0.15 Update Repository and readme

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rutility",
3-
"version": "1.0.16",
3+
"version": "1.0.17",
44
"main": "dist/index.js",
55
"browser": "dist/index.js",
66
"module": "dist/index.js",
@@ -10,9 +10,12 @@
1010
"test:coverage": "npx jest --coverage --collectCoverageFrom='src/**/*.ts'",
1111
"test:lint": "eslint --fix",
1212
"test": "npm run test:unit & npm run test:coverage & npm run test:lint & npm run prettier-format",
13-
"build": "tsc --project tsconfig.json"
13+
"build": "npm run test && tsc --project tsconfig.json",
14+
"public-npm": "npm run build && npm publish --access public"
1415
},
15-
"files": ["dist"],
16+
"files": [
17+
"dist"
18+
],
1619
"exports": {
1720
".": {
1821
"import": "./dist/index.js",
@@ -55,4 +58,4 @@
5558
"typescript-eslint": "^7.17.0",
5659
"undici-types": "^6.19.4"
5760
}
58-
}
61+
}

0 commit comments

Comments
 (0)