funkwhale/front/src/utils/event-validators.ts

6 lines
119 B
TypeScript

export const preventNonNumeric = (e: KeyboardEvent) => {
if (!e.key.match(/![0-9]$/)) {
e.preventDefault()
}
}