Utils.fromHex function now defaults to automatically strip all delimiters. Fixes #295

This commit is contained in:
n1474335 2018-04-30 16:51:04 +00:00
parent d18a7df3bc
commit 72f7f0b70c
3 changed files with 10 additions and 5 deletions

View file

@ -718,10 +718,10 @@ const Utils = {
* Utils.fromHex("0a:14:1e", "Colon");
*/
fromHex: function(data, delim, byteLen) {
delim = delim || (data.indexOf(" ") >= 0 ? "Space" : "None");
delim = delim || "Auto";
byteLen = byteLen || 2;
if (delim !== "None") {
const delimRegex = Utils.regexRep[delim];
const delimRegex = delim === "Auto" ? /[^a-f\d]/gi : Utils.regexRep[delim];
data = data.replace(delimRegex, "");
}