
Product
Go Support Is Now Generally Available
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
rut-helper
Advanced tools
rut-helper es una librería javascript para manipular Ruts chilenos.
Utiliza NPM para instalar la libreria
npm install rut-helper
//Opcion 1 : importar todas las funciones
const rh = require("rut-helper");
//Opcion 2 : importar solo las funciones que consideres que necesitas
const {
extractRut,
extractDv,
isFormatoRutValido,
isRutValido,
isDvValido,
getCleanRut,
getValidDV,
getRutFormato,
getRutStatus,
} = require("rut-helper");
Devuelve RUT de un RUT entregado (con digito verificador)
const { extractRut } = require("rut-helper");
const rutUsuario = "12.345.678-9";
const rut_sinDv = extractRut(rutUsuario); //output:12345678
Devuelve el dígito verificador(dv) de un RUT entregado
const { extractDv } = require("rut-helper");
const rutUsuario = "12.345.678-9";
const dv = extractDv(rutUsuario); //output: 9
Valida que el RUT entregado tiene una estructura valido
const { isFormatoRutValido } = require("rut-helper");
const rutCliente = "a2.345.678-9"; //estructura no valida
if (!isFormatoRutValido(rutCliente)) {
//tu codigo
}
Valida que el RUT entregado(con digito verificador) sea válido.
const { isRutValido } = require("rut-helper");
const rutUsuario = "12.345.678-9"; //rut invalido
if (!isRutValido(rutUsuario)) {
//tu codigo
}
Valida que el digito verificador del RUT entregado sea válido
const { isDvValido } = require("rut-helper");
const rutUsuario = "12.345.678-9"; //rut invalido
if (!isDvValido(rutUsuario)) {
//tu codigo
}
Devuelve el rut entregado sin puntos, espacios,guiones y en mayúscula
const { getCleanRut } = require("rut-helper");
const rutUsuario = "12.345.678-k";
const rutLimpio = getCleanRut(rutUsuario); //12345678K
Devuelve el digito verificador que corresponde al Rut entregado
const { getValidDV } = require("rut-helper");
const rutUsuario = "12345678"; //sin digito verificador
const validDv = getValidDV(rutUsuario); //Output: 5
Devuelve el RUT entregado con puntos y guion
const { getRutFormato } = require("rut-helper");
const rutUsuario = "123456789";
const rutConFormato = getRutFormato(rutUsuario); //Output: 12.345.678-9
Devuelve un objeto con todas las caracteristicas de un RUT
const { getRutStatus } = require("rut-helper");
const rutUsuario = "12.345.678-5";
const result = getRutStatus(rutUsuario);
//output:
result:
{
rut: '12345678',
dv: '5',
formato: '12.345.678-5',
isRutValido: true,
isDvValido: true,
isFormatoValido: true
}
FAQs
funciones para manipular RUT chilenos
The npm package rut-helper receives a total of 0 weekly downloads. As such, rut-helper popularity was classified as not popular.
We found that rut-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
Security News
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
Security News
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.