@@ -25,95 +25,99 @@ const { format, calculateDv, isValidRut, isFormat } = require('rutility');
2525import { 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
119123If you wish to contribute to this project, please open an issue or submit a pull request.
0 commit comments