@nodecfdi/base-converter
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

@nodecfdi/base-converter

Source Code Npm Node Version Support Discord Latest Version Software License Build Status Reliability Maintainability Code Coverage Violations Total Downloads

TS utility for converting an input from any base to another base the min base this library accepts is 2.

🇺🇸 The documentation of this project is in spanish as this is the natural language for intended audience.

🇲🇽 La documentación del proyecto está en español porque ese es el lenguaje principal de los usuarios.

Acerca de @nodecfdi/base-converter

Librería que convierte un numero entre bases arbitrarias

Instalación

NPM

npm i @nodecfdi/base-converter --save

YARN

yarn add @nodecfdi/base-converter

PNPM

pnpm add @nodecfdi/base-converter

Implementación

El convertidor espera tres parámetros: converter.convert(input, fromBase, toBase)

import { BaseConverter } from '@nodecfdi/base-converter';
// this is the main reason to exists of BaseConverter class
// since parseInt and toString cannot handle large inputs
const input = '3330303031303030303030333030303233373038';
const converter = BaseConverter.createBase36();
// result will be: 292233162870206001759766198425879490508935868472
const result = converter.convert(input, 16, 10);

Alternativamente se puede definir cualquier sequencia y no es sensitivo a mayusculas o minusculas:

import { BaseConverter, BaseConverterSequence } from '@nodecfdi/base-converter';
const hexSequence = new BaseConverterSequence('0123456789abCDEF');
const converter = new BaseConverter(hexSequence);
const input = 'FFff';
// resut will be: 1111111111111111
converter.convert(input, 16, 2);

Soporte

Puedes obtener soporte abriendo un ticket en Github.

Adicionalmente, esta librería pertenece a la comunidad OcelotlStudio, así que puedes usar los mismos canales de comunicación para obtener ayuda de algún miembro de la comunidad.

Compatibilidad

Esta librería se mantendrá compatible con al menos la versión con soporte activo de Node más reciente.

También utilizamos Versionado Semántico 2.0.0 por lo que puedes usar esta librería sin temor a romper tu aplicación.

Contribuciones

Las contribuciones con bienvenidas. Por favor lee CONTRIBUTING para más detalles y recuerda revisar el archivo CHANGELOG.

Copyright y Licencia

The @nodecfdi/base-converter library is copyright © NodeCfdi - OcelotlStudio and licensed for use under the MIT License (MIT). Please see LICENSE for more information.

Package Sidebar

Install

npm i @nodecfdi/base-converter

Weekly Downloads

2,348

Version

1.0.3

License

MIT

Unpacked Size

17.6 kB

Total Files

7

Last publish

Collaborators

  • luffynando
  • celli33