MCPcopy Create free account
hub / github.com/cppla/ServerStatus / parseCustom

Function parseCustom

web/js/app.js:378–385  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

376}
377
378function parseCustom(str){
379 if(typeof str !== 'string' || !str.trim()) return [];
380 return str.split(';').map(seg => {
381 const [name, val] = seg.split('=');
382 const ms = parseInt((val || '').trim(), 10);
383 return name && Number.isFinite(ms) ? { name: name.trim(), ms: Math.max(0, ms) } : null;
384 }).filter(Boolean);
385}
386function signalBars(ms){
387 const levels = [20, 50, 100, 160];
388 let on = typeof ms === 'number' ? (ms <= levels[0] ? 5 : ms <= levels[1] ? 4 : ms <= levels[2] ? 3 : ms <= levels[3] ? 2 : 1) : 0;

Callers 1

monitorItemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected