all-your-base
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "all-your-base", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "convert from/to binary, hexadecimal, decimal values", | ||
"main": "./index.js", | ||
"keywords": [ | ||
@@ -18,3 +19,2 @@ "base converter", | ||
}, | ||
"main": "./index.js", | ||
"repository": { | ||
@@ -28,3 +28,8 @@ "type": "git", | ||
"preferGlobal": false, | ||
"private": false | ||
"scripts": { | ||
"test": "mocha test/*.js" | ||
}, | ||
"bin": { | ||
"ayb": "./cli.js" | ||
} | ||
} |
@@ -1,4 +0,5 @@ | ||
##convert from one base to another | ||
supported bases: | ||
Convert from one base to another | ||
#####Supported bases | ||
| base/radix | name | module's abbr. | | ||
@@ -11,43 +12,74 @@ |:-----------|:------------|:---------------| | ||
common utility functions & tables stored in `./src/x.js` and `./src/tables.js` | ||
##Installation | ||
###how to use: | ||
####choosing an operation: | ||
`[old]To[New]` | ||
where `[old]` is the first three letters of the base you are converting from | ||
and `[New]` is the first three letters of the base to convert to | ||
`npm install all-your-base` | ||
####parameter data types | ||
to convert from decimal, pass in a non-negative integer | ||
##Usage | ||
Use this in your own scripts and/or as a stand-alone command-line tool. | ||
###From a script | ||
`decToBin(22);` | ||
`hexToDec('10000');` | ||
#####Parameter data types | ||
to convert from decimal, pass in a non-negative integer | ||
to convert from any base *except for* decimal, pass in the value as a string | ||
###As command line tool | ||
#####Install as command line tool | ||
`npm link` from your local repo's root. The executable is named `ayb`. | ||
#####From command line | ||
`ayb decToBin 65536` | ||
`ayb hexToDec FF001D` | ||
--- | ||
###todo: | ||
####type-checking & error handling | ||
###List of all operations | ||
function converting from decimal should accept integers | ||
all other functions should accept parameters as strings | ||
Here's an exhaustive list for your reference. | ||
####planned bases to support | ||
From binary | ||
* `binToDec` | ||
* `binToHex` | ||
* `binToOct` | ||
| base/radix | name | module's abbr. | | ||
|:-----------|:-----------------|:---------------| | ||
| base 12 | duodecimal | `b12` | | ||
| base 24 | tetravigesimal | `b24` | | ||
| base 26 | hexavigesimal | `b26` | | ||
| base 32 | duotrigesimal | `b32` | | ||
| base 36 | hexatrigesimal | `b36` | | ||
| base 60 | sexagesimal | `b60` | | ||
| base 62 | duosexigesimal | `b62` | | ||
| base 64 | tetrasexagesimal | `b64` | | ||
From octal | ||
* `octToDec` | ||
* `octToBin` | ||
* `octToHex` | ||
From decimal | ||
* `decToBin` | ||
* `decToHex` | ||
* `decToOct` | ||
From hexadecimal | ||
* `hexToDec` | ||
* `hexToBin` | ||
* `hexToOct` | ||
The pattern: `[old]To[New]` | ||
`[old]` is the first three letters of the base you are converting from. | ||
`[New]` is the first three letters of the base to convert to. | ||
Notice, the function name is lowerCamelCased. | ||
--- | ||
###good links: | ||
[how to understand hexadecimal](http://www.wikihow.com/Understand-Hexadecimal) | ||
[binary to hexadecimal](http://www.wikihow.com/Convert-Binary-to-Hexadecimal) | ||
[binary to decimal](http://www.wikihow.com/Convert-Binary-to-Decimal) | ||
[decimal to hexadecimal](http://www.wikihow.com/Convert-from-Decimal-to-Hexadecimal) | ||
[decimal to binary](http://www.wikihow.com/Convert-from-Decimal-to-Binary) | ||
[hexadecimal to binary or decimal](http://www.wikihow.com/Convert-Hexadecimal-to-Binary-or-Decimal) | ||
###Helpful links | ||
Learn more about different bases. | ||
* [binary to decimal](http://www.wikihow.com/Convert-Binary-to-Decimal) | ||
* [binary to hexadecimal](http://www.wikihow.com/Convert-Binary-to-Hexadecimal) | ||
* [decimal to binary](http://www.wikihow.com/Convert-from-Decimal-to-Binary) | ||
* [decimal to hexadecimal](http://www.wikihow.com/Convert-from-Decimal-to-Hexadecimal) | ||
* [hexadecimal to binary or decimal](http://www.wikihow.com/Convert-Hexadecimal-to-Binary-or-Decimal) | ||
* [how to understand hexadecimal](http://www.wikihow.com/Understand-Hexadecimal) |
@@ -1,8 +0,8 @@ | ||
var x = require('./x.js'); | ||
var h = require('./helpers.js'); | ||
var tables = require('./tables.js'); | ||
var makePowersOf = x.makePowersOf; | ||
var genPowersArray = x.genPowersArray; | ||
var zeroPadding = x.zeroPadding; | ||
var scan = x.scan; | ||
var makePowersOf = h.makePowersOf; | ||
var genPowersArray = h.genPowersArray; | ||
var zeroPadding = h.zeroPadding; | ||
var scan = h.scan; | ||
@@ -9,0 +9,0 @@ /** |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23278
12
634
85
1