File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Helper para validar que una cadena contenga únicamente dígitos.
2+ export default function isDigits ( value : string ) : boolean {
3+ return / ^ \d + $ / . test ( value ) ;
4+ }
Original file line number Diff line number Diff line change 1+ import isDigits from "../helpers/isDigits" ;
2+
13export default function isCedula ( cedula : string ) : boolean {
24 // Validamos que la cédula tenga 10 dígitos
35 if ( cedula . length !== 10 ) {
46 return false ;
57 }
68
79 // Verificamos que todos los caracteres sean dígitos
8- if ( ! / ^ \d + $ / . test ( cedula ) ) {
10+ if ( ! isDigits ( cedula ) ) {
911 return false ;
1012 }
1113
Original file line number Diff line number Diff line change 1+ import isDigits from "../helpers/isDigits" ;
12import isCedula from "./isCedula" ;
23
34export default function isRUC ( ruc : string ) : boolean {
@@ -7,7 +8,7 @@ export default function isRUC(ruc: string): boolean {
78 }
89
910 // Verificamos que todos los caracteres sean dígitos
10- if ( ! / ^ \d + $ / . test ( ruc ) ) {
11+ if ( ! isDigits ( ruc ) ) {
1112 return false ;
1213 }
1314
You can’t perform that action at this time.
0 commit comments