1.0.2 • Published 5 years ago

numconv v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

numconv

Utility to convert integers between bases

Build Status JavaScript Style Guide Codacy Badge install size

Install

$ npm i -g numconv

or

$ npm i numconv --save

Usage

$ numconv --help

or

var numConv = require('numConv')

// numConv(inputVar, inputBase, outputBase)
var obj = numConv('0xFF', 16, 10)

/* obj = {
 *  var: 255,
 *  err_code: 1,
 *  log: ''
 * } */

NOTE:

  • inputVar must be a string if it contains any characters. Can be an integer if only values 0-9 are used
  • inputBase and outputBase must be bases 2-32

Output

Format of the return output is as follows:

var: Is the converted value. Will be === 0 if an error is encountered.

err_code: Can be used for validity checking. Will return 1 on success.

log: Will be '' by default, or on success. A string describing the error will be returned if err_code === 0 (error)

License

ISC © Contributors

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.7.6

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago