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

creditu-common-library

v3.0.1

Published

Librería de cálculos financieros y matemáticos de Creditú (oferta hipotecaria, deuda, ratios)

Readme

Creditú Common Library

Librería TypeScript con los módulos y funciones matemáticas y financieras que usan las aplicaciones de Creditú: cálculo de oferta hipotecaria, deuda/amortización y ratios de endeudamiento.

  • Repositorio: https://github.com/creditu-org/creditu-common-library (la copia en GitLab está archivada)
  • Paquete: creditu-common-library, publicado desde GitHub Actions con npm Trusted Publishing al pushear un tag v*

Instalar

npm i creditu-common-library

Módulos

  • math — MathService: aritmética de precisión sobre dinero.js (add, subtract, multiply, divide, round). Todos los demás servicios reciben una instancia en su constructor: new MathService(useRound = true, precision = 6).
  • offer — cálculo de oferta (flujo de originación). OfferService.calculateCreditAmountToOffer(inputs, params) → OfferResponse orquesta los sub-servicios ConstantsService, CreditInsuranceService, FinanceService, InstallmentService, LoanToValueService, MaximumLocalService y OperationalExpensesService.
  • debt — deuda activa y amortización (flujo de servicing): AmortizationService, BalanceService, InflationService, InstallmentService, InsuranceService, InterestService, LateService, MonthlyPaymentService.
  • shared/models — value objects (validan en el constructor) y enums compartidos.
  • middlewares — AppLoggerMiddleware (logger HTTP para NestJS).

Cada función lleva en su JSDoc el enlace a la definición matemática en la wiki de Oferta.

Uso

import { MathService } from 'creditu-common-library/math';
import { OfferService } from 'creditu-common-library/offer/services';
import { OfferInputs, OfferParams } from 'creditu-common-library/offer/models/dto';

const offerService = new OfferService(new MathService(true, 10));
const offer = offerService.calculateCreditAmountToOffer(inputs, params);

Ratios de endeudamiento (desde 3.0.0)

Regla de Riesgo (24-ago-2026): la deuda de largo plazo (longTermMonthlyFee, p. ej. un hipotecario con otro banco) afecta solo la Carga Financiera.

| Ratio | Campo | Fórmula | |---|---|---| | Dividendo Renta (DR) | frontEndRatio | cuota del crédito / ingreso | | Carga Financiera (CF) | backEndRatio | (cuota del crédito + LP + CP) / ingreso |

El máximo local por DR (approvedAmountIncomeDividend) es el inverso del DR y ya no descuenta la cuota LP; el máximo local por CF sí. Detalle en openspec/specs/offer-debt-ratios/spec.md.

Breaking en 3.0.0: OfferService.getFrontEndRatio(creditInstallment, monthlyIncome, creditInsuranceFeeTermDefinition, creditInsuranceInstallment?) y MaximumLocalService.incomeDividend(params) perdieron el parámetro de cuota de largo plazo.

Desarrollo

npm run build            # compila a lib/
npm run lint             # tsc --noEmit + eslint
npm run test:unit        # unit (.spec.ts en src/)
npm run test:cov         # unit con cobertura (umbral 80 %)
npm run test:functional  # suite funcional en test/

Para probar en un consumidor sin publicar: npm link aquí y npm link creditu-common-library en el otro repo.

Publicar

  1. Mergear a master con la versión ya subida en package.json (npm version <major|minor|patch> --no-git-tag-version).
  2. git tag -a vX.Y.Z -m "..." && git push origin vX.Y.Z → publish.yml compila y publica vía OIDC (sin tokens).