basea
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Basea Travis CI Build Status

Convert between numerical bases.

NPM Badge

Install

npm install basea

Usage

const basea = require("basea");
 
basea(20, 16); // Convert 20 to base 16
//=> '14'
 
basea("14", 16, 10); // Convert 20 to base 10 from base 16
//=> '20'
 
basea(10, "abc"); // Convert 10 to use a custom base
//=> 'bab'

API

basea(number, from, to)

basea(number, to)

basea(stringNumber, from)

number

Type: number or string

The number to convert.

from

Type: number or string

The base to convert from.

to

Type: number or string

The base to convert to.

basea.bases

Type: object

Numerical bases to use for conversion. Can be modified to affect the output of basea, such as basea.bases[999] = "abc".

Package Sidebar

Install

npm i basea

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.81 kB

Total Files

6

Last publish

Collaborators

  • richienb