python-struct
Advanced tools
31
index.js
@@ -483,3 +483,13 @@ const Long = require('long'); | ||
decimal = decimal ? parseInt(decimal, 10) : 0; | ||
repeat = (decimal && c !== 's' && c !== 'p') ? decimal : 1; | ||
if (c === 's') { | ||
repeat = 1; | ||
size = decimal; | ||
} else if (c === 'p') { | ||
repeat = 1; | ||
size = decimal || 1; | ||
} else { | ||
repeat = decimal || 1; | ||
} | ||
unpack = op[2]; | ||
@@ -553,3 +563,13 @@ while (repeat > 0) { | ||
decimal = decimal ? parseInt(decimal, 10) : 0; | ||
repeat = (decimal && c !== 's' && c !== 'p') ? decimal : 1; | ||
if (c === 's') { | ||
repeat = 1; | ||
size = decimal; | ||
} else if (c === 'p') { | ||
repeat = 1; | ||
size = decimal || 1; | ||
} else { | ||
repeat = decimal || 1; | ||
} | ||
pack = op[3]; | ||
@@ -567,7 +587,8 @@ while (repeat > 0) { | ||
pack(data[dIndex], packed, position, decimal); | ||
// Update position according to size | ||
position += size; | ||
dIndex++; | ||
} | ||
// Update position according to size | ||
position += size; | ||
@@ -574,0 +595,0 @@ // Decrement repeat count |
{ | ||
"name": "python-struct", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Packs/Unpacks/Measures structs according to Python's `struct` format", | ||
@@ -27,4 +27,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"long": "^3.1.0" | ||
"long": "^3.2.0" | ||
} | ||
} |
23547
2.13%523
3.16%