This commit is contained in:
Sascha Buehrle 2026-03-16 09:50:47 +00:00 committed by GitHub
commit ae8c933d3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View file

@ -50,6 +50,7 @@ const HEX_ALPHABET_MAP = HEX_ALPHABET.split("");
export function toModhex(data, delim=" ", padding=2, extraDelim="", lineSize=0) {
if (!data) return "";
if (data instanceof ArrayBuffer) data = new Uint8Array(data);
if (data.length === 0) return "";
const regularHexString = toHex(data, "", padding, "", 0);
@ -100,6 +101,7 @@ export function toModhex(data, delim=" ", padding=2, extraDelim="", lineSize=0)
export function toModhexFast(data) {
if (!data) return "";
if (data instanceof ArrayBuffer) data = new Uint8Array(data);
if (data.length === 0) return "";
const output = [];

View file

@ -147,4 +147,24 @@ dc;ii;hv;ig;hr;hf;dc;he;hj;hv;hv;ie;hg;du",
}
]
},
{
name: "Empty input through From Hex and To Modhex returns empty output",
input: "",
expectedOutput: "",
recipeConfig: [
{
"op": "From Hex",
"args": [
"Auto"
]
},
{
"op": "To Modhex",
"args": [
"Space",
0
]
}
]
},
]);