Add web front-end and fix API issues
CI/CD Pipeline / test (push) Failing after 2m38s
CI/CD Pipeline / deploy-internal (push) Has been skipped

This commit is contained in:
chris committed 2026-08-28 21:47:05 -04:00
1 parent 45ca4de0ad
commit a7524412f0
2571 files changed
+86998 -5

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
/**
* Escapes a string for use in a regular expression.
*/
export function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
/**
* Casts a value to an array if it's not one.
*/
export function castArray(value) {
return (Array.isArray(value) ? value : value != null ? [value] : []);
}
/**
* Splits a string on `delimiter`, ignoring delimiters inside parentheses.
* Trims each segment and discards empty ones.
*
* Examples:
* splitOutsideParens('red,rgb(255,0,0),blue', ',') → ['red', 'rgb(255,0,0)', 'blue']
* splitOutsideParens('black.bgHex(#533AFD).dim', '.') → ['black', 'bgHex(#533AFD)', 'dim']
*/
export function splitOutsideParens(input, delimiter) {
const segments = [];
let current = '';
let parenDepth = 0;
for (const char of input) {
if (char === '(')
parenDepth++;
else if (char === ')')
parenDepth--;
if (char === delimiter && parenDepth === 0) {
const trimmed = current.trim();
if (trimmed)
segments.push(trimmed);
current = '';
}
else {
current += char;
}
}
const trimmed = current.trim();
if (trimmed)
segments.push(trimmed);
return segments;
}
/**
* Error thrown when a condition is reached that should be impossible.
*/
export class UnreachableError extends Error {
constructor(value) {
super(`Unreachable condition: ${value}`);
}
}