@try-at-software/input-elements
Version:
A package providing different input elements that are extensible and easily configurable for your custom needs.
27 lines (26 loc) • 794 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFormState = void 0;
function getFormState(inputs) {
if (!inputs || !Array.isArray(inputs) || inputs.length <= 0)
return { isValid: false, hasChanges: false };
let isValid = true;
let hasChanges = false;
let index = 0;
while ((isValid || !hasChanges) && index < inputs.length) {
const currentInput = inputs[index];
if (!currentInput) {
isValid = false;
}
else {
isValid = isValid && currentInput.isValid;
hasChanges = hasChanges || currentInput.hasChanges;
}
index++;
}
return {
isValid,
hasChanges
};
}
exports.getFormState = getFormState;