feat(frontend): add extractNumber helper
This commit is contained in:
@@ -218,3 +218,15 @@ export function runAnalysis(rows, timestampCol, noteCol, classifications) {
|
||||
consecutiveStats,
|
||||
};
|
||||
}
|
||||
|
||||
// ── Numeric extraction (for numerical buckets) ────────────────────────────────
|
||||
|
||||
/**
|
||||
* Extract the first signed decimal from a string. Returns null if none found.
|
||||
* Examples: "L25.5" -> 25.5, "R-12" -> -12, "abc" -> null
|
||||
*/
|
||||
export function extractNumber(str) {
|
||||
if (str == null) return null;
|
||||
const m = String(str).match(/-?\d+(\.\d+)?/);
|
||||
return m ? parseFloat(m[0]) : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user