logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

errors.js (345B)


  1. import { capitalize } from 'lodash'
  2. export function humanizeErrors (errors) {
  3. return Object.entries(errors).reduce((errs, [k, val]) => {
  4. const message = val.reduce((acc, message) => {
  5. const key = capitalize(k.replace(/_/g, ' '))
  6. return acc + [key, message].join(' ') + '. '
  7. }, '')
  8. return [...errs, message]
  9. }, [])
  10. }