Package Exports
- baseconvert
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (baseconvert) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
baseconvert
This module is based on this Gist by faisalman.
Installation
Install via npm
npm install baseconvert --saveRequire in your application
var baseConvert = require('baseconvert');Usage
var baseConvert = require('baseconvert');
var myDecimalNumber = baseConvert.hex2dec('ff');
console.log(myDecimalNumber); // echoes 255References
The following methods are available:
bin2hexconverts a binary into an hexadecimalhex2binconverts an hexadecimal into a binarybin2decconverts a binary into a decimaldec2binconverts a decimal into a binaryhex2decconverts an hexadecimal into a decimaldec2hexconverts a decimal into an hexadecimal
You can also play with any other needed bases:
var myNumber = baseConvert.converter(1234).fromBase(10).toBase(8);