A small OO number converter in Js. Convert (hex|dec|bin) to/from (hex|dec|bin).
npm install u-redux
cd /path/to/your/project
npm i num-converter-js
`
Testing
From your application code.
`
const numConv = require('num-converter-js')
const myHexNum = numConv.decToHex(10)
`
API
$3
Under ongoing development, but all methods stable as of 0.1.0. (Binary coming soon.)
`
const htd = numberConverterJs.hexToDec, dth = numberConverterJs.decToHex
const hex1 = '0x123f', hex2 = '123f', hex3 = 123,
dec1 = '123', dec2 = '1.23', dec3 = 0.123, dec4 = .123 // Returns Decimal Values
console.log(
h2d1: ${htd(hex1)} h2d2: ${htd(hex2)} h2d3: ${htd(hex3)}) // Returns Hex Values
console.log(
d2h1: ${dth(dec1)} d2h2: ${dth(dec2)} d2h3: ${dth(dec3)} d2h4: ${dth(dec4)})
`
Use hexToDec && decToHex methods to convert numbers. The variable above indicate all of the forms in which you can pass values to the respective functions. ---
$3
#### numConverterJs.hexToDec([hexValue])
hexValue - (string|number) - 0x123f, 123f or 123*Returns a Decimal Value.
---
#### numConverterJs.decToHex([
decValue])
decValue` - (string|number) - 123, 1.23, 0.123 or .123*Returns a Hex Value.
---