- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
34 lines
774 B
JavaScript
34 lines
774 B
JavaScript
/** Returns a regular expression quantifier with an upper and lower limit. */
|
|
export function limit(lower, upper)
|
|
{
|
|
if ((lower < 0) || (upper <= 0) || (upper < lower)) {
|
|
throw new TypeError()
|
|
}
|
|
return `{${lower},${upper}}`
|
|
}
|
|
|
|
/**
|
|
* Trims away any characters after the first match of {@code pattern} in {@code candidate},
|
|
* returning the trimmed version.
|
|
*/
|
|
export function trimAfterFirstMatch(regexp, string)
|
|
{
|
|
const index = string.search(regexp)
|
|
|
|
if (index >= 0) {
|
|
return string.slice(0, index)
|
|
}
|
|
|
|
return string
|
|
}
|
|
|
|
export function startsWith(string, substring)
|
|
{
|
|
return string.indexOf(substring) === 0
|
|
}
|
|
|
|
export function endsWith(string, substring)
|
|
{
|
|
return string.indexOf(substring, string.length - substring.length) === string.length - substring.length
|
|
}
|