Open RuStrannik opened 2 years ago
There might also be few standard parsers in a drop-down auto-fill menu, like:
<select>
<option value="">Select from some standard parsers</option>
<option value="function(value) { return value.split(/\\s+/); }">Tabulated input parser</option>
<option value="function(value) { return value.split(','); }">CSV parser</option>
</select>
It would be very handy to pass original input from mqtt topic to mqtt explorer through a JS syntax based parser function
Sample prototype:
This is how I see it working internally:
This way, users would be able to transform whatever they have into already well enough handled Javascript object.
Example
Say, I have tabulated input, as follows:
Then I could specify how to handle this by filling
Custom Parser
window with this text:and strange text string will turn into quite meaningful object:
And now I can conveniently view history, add certain values to chart panel, etc.
NOTE
This requires calling
eval()
, which some might consider unsafe, so a warning might be shown before enabling this feature.