MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / parse

Function parse

app/rcc/scripts/parser/js/key_value_pairs.js:44–57  ·  view source on GitHub ↗

* Parses a key-value frame into an array of values. * * @param {string} frame - The key-value data from the data source * @returns {array} Array of values mapped according to keyToIndexMap

(frame)

Source from the content-addressed store, hash-verified

42 * @returns {array} Array of values mapped according to keyToIndexMap
43 */
44function parse(frame) {
45 const regex = /([\w]+)=([\d.]+)/g;
46 let match;
47
48 while ((match = regex.exec(frame)) !== null) {
49 const key = match[1];
50 const value = parseFloat(match[2]);
51
52 if (keyToIndexMap.hasOwnProperty(key))
53 parsedValues[keyToIndexMap[key]] = value;
54 }
55
56 return parsedValues;
57}

Callers

nothing calls this directly

Calls 1

execMethod · 0.80

Tested by

no test coverage detected