Files
headroom/frontend/node_modules/libphonenumber-js/source/findNumbers/util.js
Santhosh Janardhanan de2d83092e feat: Reinitialize frontend with SvelteKit and TypeScript
- 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
2026-02-17 16:19:59 -05:00

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
}