Removed padLeft and padRight in favour of String.prototype.padStart and padEnd. 'To Hex' now supports ArrayBuffers.

This commit is contained in:
n1474335 2017-12-28 14:38:57 +00:00
parent e18ec5f2b2
commit 849d41ee56
15 changed files with 77 additions and 104 deletions

View file

@ -31,13 +31,13 @@ const ByteRepr = {
/**
* To Hex operation.
*
* @param {byteArray} input
* @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string}
*/
runToHex: function(input, args) {
const delim = Utils.charRep[args[0] || "Space"];
return Utils.toHex(input, delim, 2);
return Utils.toHex(new Uint8Array(input), delim, 2);
},
@ -266,7 +266,7 @@ const ByteRepr = {
padding = 8;
for (let i = 0; i < input.length; i++) {
output += Utils.pad(input[i].toString(2), padding) + delim;
output += input[i].toString(2).padStart(padding, "0") + delim;
}
if (delim.length) {