UNPKG

isomorphic-validation

Version:

Isomorphic javascript form validation library.

14 lines (11 loc) 417 B
import firstInvalid from './first-invalid.js'; import renderEntry from '../helpers/render-entry.js'; const renderFirstError = (errorPropName = 'msg', toString = renderEntry('⚠')) => (validationResult) => [firstInvalid(validationResult)] .filter((entry) => entry.length) .map((entry) => entry.concat(errorPropName)) .map(toString) .join(''); export { renderFirstError as default };