Merge 6698452a8119b4a6fec4be90c1eefb50e324725d into 49b855c761b717b90f2a1db90458c4122c16291b
This commit is contained in:
commit
f0f7241450
@ -1288,8 +1288,8 @@ class Utils {
|
|||||||
* @param {string} token
|
* @param {string} token
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static charRep(token) {
|
static charRep(token, data="Auto") {
|
||||||
return {
|
const charMap = {
|
||||||
"Space": " ",
|
"Space": " ",
|
||||||
"Percent": "%",
|
"Percent": "%",
|
||||||
"Comma": ",",
|
"Comma": ",",
|
||||||
@ -1304,7 +1304,11 @@ class Utils {
|
|||||||
"\\x": "\\x",
|
"\\x": "\\x",
|
||||||
"Nothing (separate chars)": "",
|
"Nothing (separate chars)": "",
|
||||||
"None": "",
|
"None": "",
|
||||||
}[token];
|
};
|
||||||
|
if(token === "Auto" && data !== "Auto") {
|
||||||
|
return Object.values(charMap).find(char => data.includes(char));
|
||||||
|
}
|
||||||
|
return charMap[token];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import Utils from "../Utils.mjs";
|
|||||||
* fromDecimal("10:20:30", "Colon");
|
* fromDecimal("10:20:30", "Colon");
|
||||||
*/
|
*/
|
||||||
export function fromDecimal(data, delim="Auto") {
|
export function fromDecimal(data, delim="Auto") {
|
||||||
delim = Utils.charRep(delim);
|
delim = Utils.charRep(delim, data);
|
||||||
const output = [];
|
const output = [];
|
||||||
let byteStr = data.split(delim);
|
let byteStr = data.split(delim);
|
||||||
if (byteStr[byteStr.length-1] === "")
|
if (byteStr[byteStr.length-1] === "")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user