svelte-object
Version:
A nested component Svelte 5 Runes pattern for structuring objects/arrays and their properties
14 lines (13 loc) • 396 B
JavaScript
export function isMin(e, min, setToMin) {
if (typeof e.value !== 'number' || min === undefined || min === null)
return;
const tooSmall = e.value < min;
if (!tooSmall)
return;
if (setToMin) {
e.value = min;
e.warning(`Value must be greater than or equal to ${min}`);
}
else
e.error(`Value must be greater tan or equal to ${min}`);
}