Files
warren/frontend/utils/index.ts

19 lines
346 B
TypeScript

export function preventDefault(event: Event) {
event.preventDefault();
return event;
}
export function splitOnce(
str: string,
search: string
): [string, string | null] {
const index = str.indexOf(search);
if (index === -1) {
return [str, null];
}
return [str.slice(0, index), str.slice(index + 1)];
}