@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
20 lines (19 loc) • 572 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toErrors = void 0;
var toErrors = exports.toErrors = function toErrors(errorMessages) {
// Check to see if toErrors was already applied to errorMessages
// this flexibility allows for more consistent utility functions
var firstValue = errorMessages[0];
if (firstValue && firstValue.type === 'error' && typeof firstValue.text === 'string') {
return errorMessages;
}
return errorMessages.map(function (e) {
return {
text: e,
type: 'error'
};
});
};