UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

10 lines (9 loc) 396 B
export const toErrors = errorMessages => { // Check to see if toErrors was already applied to errorMessages // this flexibility allows for more consistent utility functions const firstValue = errorMessages[0] if (firstValue && firstValue.type === 'error' && typeof firstValue.text === 'string') { return errorMessages } return errorMessages.map(e => ({text: e, type: 'error'})) }