binary2decimal-js
v1.0.0
Published
A simple converter between binary and decimal numbers. For example: 31 -> 11111, 11111 -> 31.
Downloads
14
Maintainers
Readme
binary2decimal-js
Version 1.0.0
Description
A simple converter between binary and decimal numbers. For example: 31 -> 11111, 11111 -> 31.
Update
- First Version
install
$ npm install binary2decimal-jsusing:
toBytes
const { toBinary } = require('..');
/** toBinary Function */
console.log(toBinary('2147483647'))
//1111111111111111111111111111111(int)
console.log(toBinary('2147483647', false, false))
//1111111111111111111111111111111(string)
console.log(toBinary('2147483647', false, true))
//01111111111111111111111111111111(string)
console.log(toBinary('-2147483647', true, true))
//10000000000000000000000000000001(int)
console.log(toBinary('-32', true, true))
//1100000(int)
console.log(toBinary('-2147483647', false, true))
//10000000000000000000000000000001(string)
console.log(toBinary('-2147483647', false, false))
//Error: Negative is false
/** End */