convert2base-package

NPM package developed to perform the main base conversions involving binary, octal, decimal and hexadecimal numbers.

https://github.com/arturbomtempo-dev/convert2base-package

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.3%) to scientific vocabulary

Keywords

base-conversion binary convert2base decimal hexadecimal nodejs npm npm-package octal typescript
Last synced: 4 months ago · JSON representation ·

Repository

NPM package developed to perform the main base conversions involving binary, octal, decimal and hexadecimal numbers.

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
base-conversion binary convert2base decimal hexadecimal nodejs npm npm-package octal typescript
Created over 1 year ago · Last pushed 12 months ago
Metadata Files
Readme License Citation

README.md

Convert2Base Package

Image from Convert2Base documentation


Made with Node.js NPM Package version Status: in production MIT License

Introduction

Convert2Base is a versatile npm package designed for Node.js projects, facilitating essential base conversions such as binary, octal, decimal, and hexadecimal. It aims to streamline these calculations, offering a straightforward approach to integrating base conversion functionalities into Node.js applications.

Installation

You can install the Base Conversion Kit using npm:

bash npm install convert2base

Importing

To import the Convert2Base package into your project, you can use one of the two main ways of importing a library with JavaScript: through Node.js require or with ES6 imports.

```javascript // Using ES6 imports import { binToOct, binToDec, binToHex, octToBin, octToDec, octToHex, decToBin, decToOct, decToHex, hexToBin, hexToOct, hexToDec, } from 'convert2base';

// Using Node.js require() const convertToBase = require('convert2base'); ```

Usage

The Convert2Base package has 12 functions for converting between the main existing base numbers:

  • binToOct("number")
  • binToDec("number")
  • binToHex("number")
  • octToBin("number")
  • octToDec("number")
  • octToHex("number")
  • decToBin("number")
  • decToOct("number")
  • decToHex("number")
  • hexToBin("number")
  • hexToOct("number")
  • hexToDec("number")


Example using ES6 imports

```javascript import { binToOct, binToDec, binToHex, octToBin, octToDec, octToHex, decToBin, decToOct, decToHex, hexToBin, hexToOct, hexToDec, } from 'convert2base';

console.log('Testing binToOct:'); console.log(binToOct('101010')); // Output: '52'

console.log('Testing binToDec:'); console.log(binToDec('101010')); // Output: '42'

console.log('Testing binToHex:'); console.log(binToHex('101010')); // Output: '2A'

console.log('Testing octToBin:'); console.log(octToBin('52')); // Output: '101010'

console.log('Testing octToDec:'); console.log(octToDec('52')); // Output: '42'

console.log('Testing octToHex:'); console.log(octToHex('52')); // Output: '2A'

console.log('Testing decToBin:'); console.log(decToBin('42')); // Output: '101010'

console.log('Testing decToOct:'); console.log(decToOct('42')); // Output: '52'

console.log('Testing decToHex:'); console.log(decToHex('42')); // Output: '2A'

console.log('Testing hexToBin:'); console.log(hexToBin('2A')); // Output: '00101010'

console.log('Testing hexToOct:'); console.log(hexToOct('2A')); // Output: '52'

console.log('Testing hexToDec:'); console.log(hexToDec('2A')); // Output: '42' ```


Example using Node.js require():

```javascript const convertToBase = require('convert2base');

console.log('Testing binToOct:'); console.log(convertToBase.binToOct('101010')); // Output: '52'

console.log('Testing binToDec:'); console.log(convertToBase.binToDec('101010')); // Output: '42'

console.log('Testing binToHex:'); console.log(convertToBase.binToHex('101010')); // Output: '2A'

console.log('Testing octToBin:'); console.log(convertToBase.octToBin('52')); // Output: '101010'

console.log('Testing octToDec:'); console.log(convertToBase.octToDec('52')); // Output: '42'

console.log('Testing octToHex:'); console.log(convertToBase.octToHex('52')); // Output: '2A'

console.log('Testing decToBin:'); console.log(convertToBase.decToBin('42')); // Output: '101010'

console.log('Testing decToOct:'); console.log(convertToBase.decToOct('42')); // Output: '52'

console.log('Testing decToHex:'); console.log(convertToBase.decToHex('42')); // Output: '2A'

console.log('Testing hexToBin:'); console.log(convertToBase.hexToBin('2A')); // Output: '00101010'

console.log('Testing hexToOct:'); console.log(convertToBase.hexToOct('2A')); // Output: '52'

console.log('Testing hexToDec:'); console.log(convertToBase.hexToDec('2A')); // Output: '42' ```

You can view and run the example code for using the package at src/test.ts or via Repl.it.

Contact

If you want to get in touch regarding matters related to this project, you have two main channels: Artur Bomtempo’s LinkedIn or e-mail.

Contributors

The complete Convert2Base project was developed by Artur Bomtempo and Letícia França. Artur contributed to the NPM package and API, while Letícia created the entire graphical interface of the project, which is hosted on the web.

|
Artur Bomtempo
|
Letícia França
| | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------: |

License

Copyright (c) 2025 Artur Bomtempo Colen e Letícia Silva França

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Owner

  • Name: Artur Bomtempo Colen
  • Login: arturbomtempo-dev
  • Kind: user
  • Location: Belo Horizonte, MG
  • Company: @webtech-network

Full Stack Developer passionate about technology since 2006.

Citation (CITATION.cff)

cff-version: 1.0.1
message: Please cite this software using these metadata.
title: Convert2Base
authors:
    - family-names: Bomtempo Colen
      given-names: Artur
keywords:
    - Base Converter
    - Binary
    - Octal
    - Decimal
    - Hexadecimal
    - NPM
    - Node.js
    - TypeScript
repository-code: https://github.com/ArturColen/Convert2Base-Package
license: MIT
version: 1.0.4
date-released: 2024-05-14

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

package-lock.json npm
  • @cspotcode/source-map-support 0.8.1 development
  • @jridgewell/resolve-uri 3.1.2 development
  • @jridgewell/sourcemap-codec 1.4.15 development
  • @jridgewell/trace-mapping 0.3.9 development
  • @tsconfig/node10 1.0.11 development
  • @tsconfig/node12 1.0.11 development
  • @tsconfig/node14 1.0.3 development
  • @tsconfig/node16 1.0.4 development
  • @types/node 20.12.7 development
  • @types/strip-bom 3.0.0 development
  • @types/strip-json-comments 0.0.30 development
  • abbrev 1.1.1 development
  • acorn 8.11.3 development
  • acorn-walk 8.3.2 development
  • anymatch 3.1.3 development
  • arg 4.1.3 development
  • balanced-match 1.0.2 development
  • binary-extensions 2.3.0 development
  • brace-expansion 1.1.11 development
  • braces 3.0.2 development
  • buffer-from 1.1.2 development
  • chokidar 3.6.0 development
  • concat-map 0.0.1 development
  • create-require 1.1.1 development
  • debug 4.3.4 development
  • diff 4.0.2 development
  • dynamic-dedupe 0.3.0 development
  • fill-range 7.0.1 development
  • fs.realpath 1.0.0 development
  • fsevents 2.3.3 development
  • function-bind 1.1.2 development
  • glob 7.2.3 development
  • glob-parent 5.1.2 development
  • has-flag 3.0.0 development
  • hasown 2.0.2 development
  • ignore-by-default 1.0.1 development
  • inflight 1.0.6 development
  • inherits 2.0.4 development
  • is-binary-path 2.1.0 development
  • is-core-module 2.13.1 development
  • is-extglob 2.1.1 development
  • is-glob 4.0.3 development
  • is-number 7.0.0 development
  • lru-cache 6.0.0 development
  • make-error 1.3.6 development
  • minimatch 3.1.2 development
  • minimist 1.2.8 development
  • mkdirp 1.0.4 development
  • ms 2.1.2 development
  • nodemon 3.1.0 development
  • nopt 1.0.10 development
  • normalize-path 3.0.0 development
  • once 1.4.0 development
  • path-is-absolute 1.0.1 development
  • path-parse 1.0.7 development
  • picomatch 2.3.1 development
  • pstree.remy 1.1.8 development
  • readdirp 3.6.0 development
  • resolve 1.22.8 development
  • rimraf 2.7.1 development
  • semver 7.6.0 development
  • simple-update-notifier 2.0.0 development
  • source-map 0.6.1 development
  • source-map-support 0.5.21 development
  • strip-bom 3.0.0 development
  • strip-json-comments 2.0.1 development
  • supports-color 5.5.0 development
  • supports-preserve-symlinks-flag 1.0.0 development
  • to-regex-range 5.0.1 development
  • touch 3.1.0 development
  • tree-kill 1.2.2 development
  • ts-node 10.9.2 development
  • ts-node-dev 2.0.0 development
  • tsconfig 7.0.0 development
  • typescript 5.4.5 development
  • undefsafe 2.0.5 development
  • undici-types 5.26.5 development
  • v8-compile-cache-lib 3.0.1 development
  • wrappy 1.0.2 development
  • xtend 4.0.2 development
  • yallist 4.0.0 development
  • yn 3.1.1 development
package.json npm
  • @types/node ^20.12.7 development
  • nodemon ^3.1.0 development
  • ts-node ^10.9.2 development
  • ts-node-dev ^2.0.0 development
  • typescript ^5.4.5 development