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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kembec/sunat-utils

v1.0.3

Published

Sunat Utils es una biblioteca de código abierto para automatizar validaciones y cálculos relacionados con las normativas tributarias de SUNAT en Perú.

Downloads

35

Readme

Sunat Utils

Sunat Utils es una biblioteca desarrollada para simplificar y automatizar las validaciones y cálculos comúnmente requeridos por la Superintendencia Nacional de Aduanas y de Administración Tributaria (SUNAT) en Perú. Originalmente creada para un proyecto personal, ahora se ofrece de manera abierta con la esperanza de que pueda ser de utilidad para otros desarrolladores que trabajen con requerimientos tributarios peruanos.

Características

La biblioteca ofrece las siguientes funcionalidades:

Validación de RUC

Permite verificar si un número de RUC es válido utilizando el algoritmo módulo 11.

import { Sunat } from 'sunat-utils';

Sunat.ruc().isValid("20131312955");

Validación de DNI

Facilita la validación de un DNI verificando la cantidad correcta de caracteres.

import { Sunat } from 'sunat-utils';

Sunat.dni().isValid("23412341");

Calculadora de IGV

Proporciona métodos para calcular el IGV tanto a partir de la base imponible como del total, incluyendo la posibilidad de definir una tasa de IGV específica.

import { Sunat } from 'sunat-utils';

// Calcular el total incluyendo IGV a partir de la base imponible
Sunat.igv().fromBase(100).getTotal();

// Calcular la base imponible a partir del total
Sunat.igv().fromTotal(118).getBase();

// Definir un % de IGV específico y calcular el total
Sunat.igv().setIgvRate(10).fromBase(100).getTotal();

Formateo de Moneda

Ofrece herramientas para el formateo de cantidades monetarias en Soles (PEN) y Dólares Americanos (USD).

import { Sunat } from 'sunat-utils';

Sunat.currency().formatSoles(121314);
Sunat.currency().formatDollars(142123);

Instalación

Puedes instalar Sunat Utils usando npm:

npm install @kembec/sunat-utils

O mediante yarn:

yarn add @kembec/sunat-utils

Uso

Para utilizar Sunat Utils en tu proyecto, primero debes importar la biblioteca:

import { Sunat } from 'sunat-utils';

A continuación, puedes acceder a cualquiera de las funcionalidades proporcionadas por la biblioteca como se muestra en los ejemplos de características.

Contribuciones

Agradecemos tu interés y cualquier contribución que puedas hacer a este proyecto. Dado que mi tiempo para revisar las contribuciones puede ser limitado, te pido paciencia en el proceso de revisión. Sin embargo, valoro mucho tus ideas y sugerencias para expandir y mejorar esta librería. Si tienes alguna, por favor, no dudes en crear un fork del repositorio, implementar tus cambios y enviar un pull request. Haré mi mejor esfuerzo para revisarlo y darle seguimiento tan pronto como me sea posible.

Licencia

Sunat Utils está licenciado bajo AGPL-3.0. Se permite su uso, modificación y distribución bajo los términos de esta licencia.