Files
lonc/src/features/shared/form-utils.js
T

21 lines
435 B
JavaScript
Raw Normal View History

export function fieldError(errors, field) {
return errors[field] || '';
}
export function normalizeValidationError(error) {
if (error?.details && typeof error.details === 'object') {
return error.details;
}
return {};
}
export function debounce(callback, wait = 300) {
let timeoutId;
return (...args) => {
window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => callback(...args), wait);
};
}