1
0
mirror of https://git.pleroma.social/sjw/pleroma-fe.git synced 2024-11-11 10:19:08 +01:00
pleroma-fe/src/modules/errors.js

13 lines
342 B
JavaScript
Raw Normal View History

import { capitalize } from 'lodash'
export function humanizeErrors (errors) {
return Object.entries(errors).reduce((errs, [k, val]) => {
let message = val.reduce((acc, message) => {
let key = capitalize(k.replace(/_/g, ' '))
return acc + [key, message].join(' ') + '. '
}, '')
return [...errs, message]
}, [])
}