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

@rodmarzavala/gt-utils-js

v1.0.8

Published

Standard utility library for Guatemala (identifications, finance, vehicles, geo). Zero dependencies. Edge ready.

Readme

gt-utils-js

La biblioteca estándar definitiva, sin dependencias (Zero-Dependency) y con tipado estricto (TypeScript) para validaciones y utilidades específicas de Guatemala.

Optimizada para entornos Edge (Cloudflare Workers, Vercel Edge), Deno, Bun y Node.js. Todo el código, nombres de variables y API se mantienen estrictamente en inglés bajo principios de Clean Code, pero la lógica responde a la legislación y cultura de Guatemala.

Instalación

npm install @rodmarzavala/gt-utils-js
# o usando yarn
yarn add @rodmarzavala/gt-utils-js
# o usando pnpm
pnpm add @rodmarzavala/gt-utils-js

Características Principales

Esta biblioteca provee 7 submódulos especializados:

  • Identidad: Validación rigurosa de NIT y CUI/DPI (Módulo 11 oficial de SAT y RENAP). Incluye la nueva disposición SAT 2025 donde los CUI válidos operan como NIT. Retorna el departamento y código de municipio emisor.
  • Finanzas: Conversión de números a letras para Facturación Electrónica (FEL) y detección de bancos por número de cuenta (G&T, Banrural, BI, BAM, Promerica, etc).
  • Vehículos: Analizador y validador de Placas Vehiculares (comerciales, particulares, motos, y reglas estrictas del reglamento de tránsito, como exclusiones de vocales O, I, Q, Ñ).
  • Geografía: Resolución Inversa Nacional: pasa coordenadas (Lat, Lng) y te dice en qué municipio y departamento de Guatemala caen (Ray-Casting algorithm ligero).
  • Impuestos: Retenciones de IVA y escalonadas de ISR (Régimen General > Q2,500) redondeadas al centavo contable exacto.
  • Feriados y Calendario: Algoritmo astronómico para cálculo de Semana Santa, listado de asuetos, y traslados de feriados largos de acuerdo a la Ley de Promoción de Turismo Interno (Decreto 19-2018 y CC).
  • Laboral: Calculadora de Liquidaciones al centavo. Determina fechas de corte y pagos proporcionales de Aguinaldo, Bono 14, Vacaciones y cálculo de indemnización por despido injustificado (regla de 14 salarios / 12 meses).

Uso Rápido

La librería expone todas sus utilidades desde el punto de entrada principal.

import { 
  isValidNit, 
  isValidCui, 
  getCuiInformation,
  calculateTaxes,
  calculateSeverance,
  getLicensePlateInfo,
  getHolidays,
  findMunicipalityByLatLng,
  amountToWords
} from 'gt-utils-js';

// 1. Identidad
console.log(isValidNit('123456-0')); // true
console.log(isValidCui('1234567890101')); // true
console.log(getCuiInformation('1234567890101')); 
// { isValid: true, department: 'Guatemala', municipalityId: 1 }

// 2. Impuestos y Facturación
console.log(amountToWords(150.50)); // "CIENTO CINCUENTA QUETZALES CON 50/100 CENTAVOS"
console.log(calculateTaxes({
  amount: 3000,
  regime: 'GENERAL',
  isRetentionAgent: true,
  currency: 'GTQ'
})); 
// { subtotal: 2678.57, iva: 321.43, retentionIsr: 133.93, retentionIva: 48.21, totalToReceive: 2817.86 }

// 3. Vehículos
console.log(parseLicensePlate('P-123BCD'));
// { isValid: true, type: 'P', number: '123', letters: 'BCD' }

// 4. Laboral
console.log(calculateSeverance({
  startDate: new Date('2022-01-01'),
  endDate: new Date('2023-12-31'),
  monthlySalary: 6000,
  reason: 'UNJUSTIFIED_FIRING'
}));
// { aguinaldo, bono14, vacations, indemnizacion: 14000, totalToReceive: 20501.37, ... }

// 5. Geografía (Coordenadas -> Municipio)
// Palacio Nacional
console.log(findMunicipalityByLatLng(14.643445, -90.513222));
// { name: 'Guatemala', department: 'Guatemala' }

// 6. Feriados
const holidays2024 = getHolidays(2024);
// Retorna todos los asuetos incluyendo fechas móviles (ej. 30 de junio movido a lunes)

Documentación Detallada

Tests

El paquete tiene una cobertura de pruebas exhaustiva. Para ejecutar las pruebas tú mismo:

pnpm install
pnpm test

También incluimos un archivo playground.ts que demuestra cada funcionalidad. Para correrlo:

npx tsx src/playground.ts

Licencia

MIT