npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@devlabscl/chile-utils

v0.1.1

Published

Utilidades para desarrollo en Chile: RUT, moneda, comunas, feriados, impuestos y mas

Downloads

247

Readme

@devlabscl/chile-utils

Utilidades para desarrollo en Chile. RUT, moneda, comunas, feriados, impuestos, bancos y mas.

  • Zero dependencias
  • TypeScript + JavaScript
  • Tree-shakeable (importa solo lo que necesitas)
  • ESM + CommonJS

Instalacion

npm install @devlabscl/chile-utils

Uso

Importa solo el modulo que necesitas:

import { formatRut, isValidRut } from '@devlabscl/chile-utils/rut';
import { formatCLP } from '@devlabscl/chile-utils/currency';
import { isHoliday } from '@devlabscl/chile-utils/holidays';

O importa todo:

import { rut, currency, holidays } from '@devlabscl/chile-utils';

rut.formatRut('123456785'); // '12.345.678-5'
currency.formatCLP(1500000); // '$ 1.500.000'

Modulos

chile-utils/rut

import { formatRut, unformatRut, sanitizeRut, isValidRut, validateRut, getDv, generateRut } from '@devlabscl/chile-utils/rut';

formatRut('123456785');          // '12.345.678-5'
unformatRut('12.345.678-5');     // '123456785'
isValidRut('12.345.678-5');      // true
getDv('12345678');               // '5'
generateRut();                   // '18.432.567-3' (aleatorio, para testing)
generateRut({ formatted: false }); // '184325673'

chile-utils/currency

import { formatCLP, formatUF, formatUTM, formatUSD, formatEUR, formatNumber, formatCurrency, parseCLP, getCurrencyConfig } from '@devlabscl/chile-utils/currency';

formatCLP(1500000);              // '$ 1.500.000'
formatUF(3450.5);                // '3.450,50 UF'
formatUTM(65000);                // '65.000 UTM'
formatUSD(1250.99);              // 'US$ 1.250,99'
formatEUR(1250.99);              // '€ 1.250,99'
formatNumber(1234567);           // '1.234.567'
formatCurrency(1500000, 'CLP');  // '$ 1.500.000'
parseCLP('$ 1.500.000');         // 1500000
getCurrencyConfig('CLP');        // { code: 'CLP', symbol: '$', name: 'Peso Chileno', decimals: 0, position: 'prefix' }

chile-utils/phone

import { isValidPhone, isValidMobile, isValidLandline, formatPhone, parsePhone } from '@devlabscl/chile-utils/phone';

isValidPhone('+56912345678');    // true
isValidPhone('912345678');       // true
isValidMobile('+56912345678');   // true
isValidLandline('+56221234567'); // true
formatPhone('56912345678');      // '+56 9 1234 5678'
formatPhone('221234567');        // '+56 2 2123 4567'
parsePhone('+56912345678');      // { countryCode: '56', areaCode: '9', number: '12345678', isMobile: true }

chile-utils/location

import { getRegiones, getRegionByNumber, getRegionByIso, getProvincias, getProvinciasByRegion, getComunas, getComunaByCode, searchComunas, getComunasByRegion } from '@devlabscl/chile-utils/location';

getRegiones();                   // [{ name: 'Arica y Parinacota', number: 'XV', iso: 'CL-AP', ... }, ...]
getRegionByNumber('XIII');       // Region Metropolitana
getRegionByIso('CL-RM');         // Region Metropolitana
getProvincias();                 // todas las provincias de Chile
getProvinciasByRegion('XIII');   // provincias de la RM
getComunas();                    // todas las comunas de Chile (340+)
getComunaByCode('13101');        // { name: 'Santiago', code: '13101', ... }
searchComunas('provi');          // [{ name: 'Providencia', ... }]
getComunasByRegion('XIII');      // comunas de la RM

chile-utils/holidays

import { getHolidays, isHoliday, getNextHoliday, isBusinessDay, addBusinessDays, businessDaysBetween } from '@devlabscl/chile-utils/holidays';

getHolidays(2024);               // [{ date: Date, name: 'Ano Nuevo', type: 'civil', irrenunciable: true }, ...]
isHoliday(new Date('2024-09-18')); // true
getNextHoliday();                // proximo feriado desde hoy
isBusinessDay(new Date());       // true/false
addBusinessDays(new Date(), 5);  // salta fines de semana y feriados
addBusinessDays(new Date(), -3); // retrocede 3 dias habiles
businessDaysBetween(start, end); // dias habiles entre dos fechas (excluyendo extremos)

Feriados incluidos (17 total):

  • 15 feriados fijos (Ano Nuevo, Dia del Trabajo, Glorias Navales, Fiestas Patrias, Navidad, etc.)
  • 2 feriados movibles (Viernes Santo, Sabado Santo)

chile-utils/tax

import { calculateIVA, addIVA, removeIVA, extractIVA, calculateBoleta, getBoletaRate, IVA_RATE, BOLETA_RETENCION_RATE } from '@devlabscl/chile-utils/tax';

// IVA (19%)
IVA_RATE;                        // 0.19
calculateIVA(100000);            // { neto: 100000, iva: 19000, total: 119000 }
addIVA(100000);                  // 119000
removeIVA(119000);               // 100000
extractIVA(119000);              // 19000

// Boleta de honorarios (tasa segun Ley 21.133)
getBoletaRate(2024);             // 0.1375 (13,75%)
getBoletaRate(2025);             // 0.145  (14,50%)
getBoletaRate(2026);             // 0.1525 (15,25%)
getBoletaRate(2027);             // 0.16   (16,00%)
getBoletaRate(2028);             // 0.17   (17,00%)
BOLETA_RETENCION_RATE;           // tasa vigente del ano actual
calculateBoleta(1000000);        // { bruto: 1000000, retencion: ..., liquido: ..., tasaRetencion: ... }
calculateBoleta(1000000, 0.10);  // tasa personalizada

chile-utils/banks

import { getBanks, getBankByCode, getBankBySbifCode, searchBanks, getAccountTypes } from '@devlabscl/chile-utils/banks';

getBanks();                      // lista completa de bancos chilenos
getBankByCode('037');             // { code: '037', name: 'Banco Santander Chile', shortName: 'Santander', ... }
getBankBySbifCode('012');        // Banco del Estado de Chile
searchBanks('estado');           // [{ name: 'Banco del Estado de Chile', ... }]
getAccountTypes();               // [{ value: 'corriente', label: 'Cuenta Corriente' }, ...]

Bancos incluidos: Banco de Chile, BancoEstado, Santander, BCI, Banco Itau Chile, Scotiabank, BICE, Security, Falabella, Ripley, Consorcio, BTG Pactual, HSBC, Internacional, Bank of China, China Construction Bank, Banco Do Brasil.

Tipos de cuenta: Cuenta Corriente, Cuenta Vista / Cuenta RUT, Cuenta de Ahorro, Chequera Electronica.

chile-utils/date

import { formatDateCL, formatDateTimeCL, formatRelativeDate, getMonthName, getDayName, MONTHS_ES, DAYS_ES } from '@devlabscl/chile-utils/date';

formatDateCL(new Date());                    // '12/04/2026'
formatDateCL(new Date(), { long: true });    // '12 de Abril de 2026'
formatDateTimeCL(new Date());                // '12/04/2026 14:30'
formatRelativeDate(new Date(Date.now() - 3600000)); // 'hace 1 hora'
getMonthName(0);                             // 'Enero'
getDayName(1);                               // 'Lunes'
MONTHS_ES;                                   // ['Enero', 'Febrero', ..., 'Diciembre']
DAYS_ES;                                     // ['Domingo', 'Lunes', ..., 'Sabado']

chile-utils/address

import { formatAddress, parseAddress } from '@devlabscl/chile-utils/address';

formatAddress({
  street: 'Av. Providencia',
  number: '1234',
  unit: 'Depto 501',
  comuna: 'Providencia',
  region: 'Metropolitana'
});
// 'Av. Providencia 1234, Depto 501, Providencia, Metropolitana'

parseAddress('Av. Providencia 1234, Depto 501, Providencia');
// { street: 'Av. Providencia', number: '1234', unit: 'Depto 501', comuna: 'Providencia' }

chile-utils/documents

import { isValidCI, isValidPassport, detectDocumentType, parseDocument } from '@devlabscl/chile-utils/documents';

isValidCI('12.345.678-5');       // true (CI = RUT en Chile)
isValidPassport('AAB123456');    // true
detectDocumentType('12.345.678-5'); // 'RUT'
detectDocumentType('AAB123456');    // 'PASSPORT'
parseDocument('123456785');      // { type: 'RUT', value: '123456785', formatted: '12.345.678-5' }

chile-utils/validators

import { isValidEmail, isChileanEmail } from '@devlabscl/chile-utils/validators';

isValidEmail('[email protected]');   // true
isChileanEmail('[email protected]');  // true
isChileanEmail('[email protected]');   // false

Tipos

Todos los tipos estan exportados:

import type { CurrencyCode, CurrencyConfig } from '@devlabscl/chile-utils/currency';
import type { Region, Province, Commune } from '@devlabscl/chile-utils/location';
import type { Holiday, HolidayType } from '@devlabscl/chile-utils/holidays';
import type { TaxBreakdown, BoletaBreakdown } from '@devlabscl/chile-utils/tax';
import type { Bank, AccountType } from '@devlabscl/chile-utils/banks';
import type { Address } from '@devlabscl/chile-utils/address';
import type { DocumentType, DocumentInfo } from '@devlabscl/chile-utils/documents';
import type { PhoneInfo } from '@devlabscl/chile-utils/phone';

Desarrollo

npm run dev          # modo watch
npm run build        # compilar
npm run test         # tests en modo watch
npm run test:run     # ejecutar tests una vez
npm run typecheck    # verificar tipos

Licencia

MIT - devlabs