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

currency_contry_exchange

v1.9.7

Published

Librería TypeScript para formateo de monedas, formatos de documento (RUT/NIT), etiquetas localizadas y cálculo de intereses por país.

Downloads

337

Readme

currency_contry_exchange

Librería TypeScript para formateo de monedas, formatos de documento (RUT/NIT), etiquetas localizadas y cálculo de intereses por país.

Versión: 1.9.2 • Licencia: MIT

Contenido

  • Descripción rápida
  • Instalación
  • Uso (TypeScript)
  • Referencia de la API
  • Archivos principales
  • Comandos útiles
  • Contribuir

Descripción rápida

Provee utilidades para manejar formatos y cálculos locales (por ejemplo: CL, PE, CO). Incluye formateo de monedas, validación y formateo de documentos, generación de propiedades para inputs numéricos y cálculo de intereses (simple/compuesto).

Instalación

Usa el gestor que prefieras:

npm install currency_contry_exchange
pnpm add currency_contry_exchange
yarn add currency_contry_exchange

Tipo de paquete: módulo ESM. Incluye definiciones TypeScript en dist.

Uso (TypeScript)

import { Faastlocation } from 'currency_contry_exchange';

// Instanciar con país por defecto (opcional)
const locale = new Faastlocation('cl');

// Ejemplos
const label = locale.labels({ contry: 'cl', label: 'cliente' });
const formatted = locale.formaterCurrency({ contry: 'cl', currency: 12500 });
const rutValid = locale.validateFormaterRut({ contry: 'pe', rut: '20123456-7', isValidate: true });
const props = locale.formaterInputProps({ contry: 'cl', typeCurrenzy: 'CLP', decimalScale: 0, fixedDecimalScale: true });

// Cálculo de interés simple
const interes = locale.interestAmountunt({ contry: 'cl', type: 'simple', anticipo: 650000, tasa: 1.8, plazo: 90 });

// Cálculo de interés para Colombia con moneda extranjera
const interesCO = locale.interestAmountunt({ contry: 'co', type: 'simple', anticipo: 1000, tasa: 2.5, plazo: 30, typeCurrency: 'USD' });

Referencia de la API

Instancia principal: Faastlocation — provee los siguientes métodos:

  • labels({ contry?, label }): string

    • Descripción: Devuelve una etiqueta localizada (por ejemplo, 'cliente' → 'Cliente').
    • Notas: contry por defecto se toma de la instancia si se pasó al constructor.
  • validateFormaterRut({ contry?, rut, isValidate = false }): string | boolean

    • Descripción: Valida o formatea un RUT/NIT según país. Si isValidate es true, devuelve boolean.
  • validateFormaterDoc({ contry?, rut, isValidate = false }): string | boolean

    • Descripción: Similar a validateFormaterRut pero orientado a documentos genéricos.
  • formaterCurrency({ contry?, currency, typeCurrenzy? }): string

    • Descripción: Formatea un número como moneda (separadores, símbolos según país/tipo).
  • formaterInputProps({ contry?, typeCurrenzy?, decimalScale?, fixedDecimalScale? }): object

    • Descripción: Retorna propiedades convenientes para componentes de input numérico (ej. NumberFormat).
  • formaterAmount({ contry?, amount, typeCurrenzy? }): string

    • Descripción: Otro helper para formateo de montos con reglas locales.
  • rutValidatorIsNatural({ contry?, rut }): boolean

    • Descripción: Indica si el RUT/NIT corresponde a una persona natural.
  • symbolCurrencyIndicadorCartera({ contry? }): string

    • Descripción: Símbolo de moneda para el país (ej. $, S/).
  • formaterNumDocument({ contry?, value }): string

    • Descripción: Formatea números de documento (agrega puntos/guiones según normativa).
  • interestAmountunt({ contry?, type, anticipo, tasa, plazo, array_interes?, typeCurrency? }): number | string | any[]

    • Descripción: Calcula interés simple o compuesto. Para Chile la salida suele ser entero; para Perú tiene 2 decimales; para Colombia depende de la moneda (EUR/USD: 2 decimales, COP: entero).

Los tipos están disponibles en la definición TypeScript incluida.