Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including any-to-any with all npm packages installed. Try it out:

var anyToAny = require("any-to-any")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

any-to-any v2.1.0

convert numbers between bases ( any base to any base ) 🔀 ..

ANY-TO-ANY - converts numbers between bases ; binary , decimal , octal , hexadecimal and muche more ..


imed-jaberi

Build Status    Coverage Status    NPM version    License    Top Language    Code Size    Code of Conduct    PRs Welcome   

The purpose of this module is to convert numbers from any base to other base you want ..

Installation

# npm ..
$ npm install any-to-any
# yarn ..
$ yarn add any-to-any

Usage

This is a practical example of how to use.

// const Convert = require ('any-to-any');
const { Convert } = require ('any-to-any');

let InputNumber  = '1110111'; // 119 in decimal
let InputBase = 2;
let OutputBase = 8;

let result = Convert (InputNumber, InputBase, OutputBase);
console.log(`*****\n ${result} \n*****`);

// $your_pc_name_with_your_directory
// *****
//  167
// *****

// NOTE: in case the input number is consists of numbers only,
// you can enter the number to the function in number type ..
let InputNumber  = 1110111; // 119 in decimal
let InputBase = 2 ;
let OutputBase = 8 ;
let result = Convert ( InputNumber , InputBase , OutputBase  ); 
console.log(`*****\n ${result} \n*****`);

// $your_pc_name_with_your_directory
// *****
//  167
// *****

NOTE: There are a set of suggested examples that have been tested that you can follow here.

Some Informations

Switching between bases numbers is becoming easier with this module .. This module can convert the integers numbers between base 2 & base 36 and soon it will be possible to convert real numbers ...

License


MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free