0.5.1 • Published 6 years ago

mbdhd v0.5.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

MBDHD - Math Binary - Decimal - Hexadecimal

MBDHD aims to make math with non decimal numbers simple since Vanilla JS does not support these numbers natively.

NPM Version

Install

npm -i -S MBDHD

Usage

mbdhd makes 3 objects available to the user:

  • dec
  • bin
  • hex

each of these three objects are contain methods required to convert them into the other types

const {hex, dex, bin} = require('mbdhd');

//Lets start with a decimal number 13 and convert it into binary
let myVal = 13;
let binMyVal = dec.toBin(myVal);
// binMyVal now equals '1101'

//MBDHD also includes functions to handle and, or, xor, not
let binNumberOne = '1101';
let bunNumberTwo = '1001';
let result = bin.and(binNumberOne, binNumberTwo);
// result will be equal to '1001'

//MBDHD can also convert Array of numbers.
let myVals = hex.toDec(['f','f','e','d']);
//myVals is now equal to [15, 15, 14, 13]

License

MIT