Comparing version 0.2.9 to 0.2.10
@@ -9,9 +9,9 @@ #!/usr/bin/env node | ||
console.log("usage bla bal bal"); | ||
console.log("--width [(16)] how many bytes per line") | ||
console.log("--numbering [(hex_bytes)|none] prefix current byte count") | ||
console.log("--format [(fours)|twos|none] how many nibbles per group") | ||
console.log("--caps [(lower)|upper] case of hex chars") | ||
console.log("--annotate [(ascii)|none] provide ascii annotation") | ||
console.log("--prefix [(\"\")|<prefix>] printed in front of each line") | ||
console.log("--indent [(0)|<num>] number of spaces to indent output") | ||
console.log("--width [(16)] how many bytes per line") | ||
console.log("--numbering [(hex_bytes)|none] prefix current byte count") | ||
console.log("--format [eights|(fours)|twos|none] how many nibbles per group") | ||
console.log("--caps [(lower)|upper] case of hex chars") | ||
console.log("--annotate [(ascii)|none] provide ascii annotation") | ||
console.log("--prefix [(\"\")|<prefix>] printed in front of each line") | ||
console.log("--indent [(0)|<num>] number of spaces to indent output") | ||
console.log("parameter in (parens) are default") | ||
@@ -18,0 +18,0 @@ process.exit(1) |
12
hexy.js
@@ -63,3 +63,3 @@ // # hexy.js -- utility to create hex dumps | ||
// format.numbering = n // ["hex_bytes" | "none"], default "hex_bytes" | ||
// format.format = f // ["fours"|"twos"|"none"], how many nibbles per group | ||
// format.format = f // ["eights"|"fours"|"twos"|"none"], how many nibbles per group | ||
// // default "fours" | ||
@@ -183,2 +183,3 @@ // format.caps = c // ["lower"|"upper"], default lower | ||
case "twos": | ||
case "eights": | ||
self.format = config.format | ||
@@ -230,5 +231,7 @@ break | ||
raw = hex_raw[1] | ||
//insert spaces every `self.format.twos` or fours | ||
//insert spaces every `self.format.twos`, fours or eights | ||
var howMany = hex.length | ||
if (self.format === "fours") { | ||
if (self.format === "eights") { | ||
howMany = 8 | ||
} else if (self.format === "fours") { | ||
howMany = 4 | ||
@@ -261,2 +264,5 @@ } else if (self.format === "twos") { | ||
switch(self.format) { | ||
case "eights": | ||
padlen = self.width*2 + Math.floor(self.width/4) | ||
break | ||
case "fours": | ||
@@ -263,0 +269,0 @@ padlen = self.width*2 + Math.floor(self.width/2) |
{ | ||
"name" : "hexy", | ||
"version" : "0.2.9", | ||
"version" : "0.2.10", | ||
"description" : "hexdump, binary pretty-printing", | ||
@@ -5,0 +5,0 @@ "author" : "Tim Becker <tim.becker@kuriositaet.de>", |
@@ -64,3 +64,3 @@ [![build status](https://secure.travis-ci.org/a2800276/hexy.js.png)](http://travis-ci.org/a2800276/hexy.js) | ||
format.numbering = n // ["hex_bytes" | "none"], default "hex_bytes" | ||
format.format = f // ["fours"|"twos"|"none"], how many nibbles per group | ||
format.format = f // ["eight"|"fours"|"twos"|"none"], how many nibbles per group | ||
// default "fours" | ||
@@ -143,2 +143,3 @@ format.caps = c // ["lower"|"upper"], default lower | ||
* Koen Houtman (https://github.com/automagisch) | ||
* Stef Levesque (https://github.com/stef-levesque) | ||
@@ -145,0 +146,0 @@ ## History |
16
test.js
@@ -38,2 +38,6 @@ var hexy = require("./hexy.js") | ||
"00000000: 30313233 34353637 38396162 63646566 0123456789abcdef\n" + | ||
"00000010: 6768696a 6b6c6d6e 6f707172 73747576 ghijklmnopqrstuv\n" + | ||
"00000020: 77787a79 wxzy\n", | ||
"00000000: 30313233343536373839616263646566 0123456789abcdef\n"+ | ||
@@ -89,2 +93,3 @@ "00000010: 6768696a6b6c6d6e6f70717273747576 ghijklmnopqrstuv\n"+ | ||
{format:"twos"}, | ||
{format:"eights"}, | ||
{format:"none"}, | ||
@@ -177,13 +182,8 @@ {annotate:"none"}, | ||
arr_e = `00000000: 0102 .. | ||
00000002: 030f .. | ||
` | ||
arr_e = "00000000: 0102 ..\n00000002: 030f ..\n" | ||
failed += check(arr_e, hexy.hexy(arr, {width: "2"})) | ||
++total | ||
arr_e = `00000000: 01 . | ||
00000001: 02 . | ||
00000002: 03 . | ||
00000003: 0f . | ||
` | ||
arr_e = "00000000: 01 .\n00000001: 02 .\n00000002: 03 .\n00000003: 0f .\n" | ||
@@ -190,0 +190,0 @@ failed += check(arr_e, hexy.hexy(arr, {width: 1})) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28767
584
158