@inkline/inkline
Version:
Inkline is the intuitive UI Components library that gives you a developer-friendly foundation for building high-quality, accessible, and customizable Vue.js 3 Design Systems.
15 lines (14 loc) • 441 B
JavaScript
export const max = (value, options) => {
if (typeof options.value === "undefined") {
console.error('The "value" option must be specified for "max" validator.');
return true;
}
if (typeof value === "undefined" || value === null) {
return false;
}
const process = (v) => Number(v);
if (Array.isArray(value)) {
return value.every((v) => process(v) <= options.value);
}
return process(value) <= options.value;
};