Move humanizeErrors to errors service file

This commit is contained in:
Sean King 2025-02-08 19:26:29 -07:00
commit 2af00f7c7e
No known key found for this signature in database
GPG key ID: 510C52BACD6E7257
3 changed files with 11 additions and 12 deletions

View file

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