Use Array.reduce instead of lodash.reduce
This commit is contained in:
parent
822559afd8
commit
02e000b53e
|
@ -1,8 +1,8 @@
|
||||||
import {capitalize, reduce} from 'lodash'
|
import { capitalize } from 'lodash'
|
||||||
|
|
||||||
export function humanizeErrors (errors) {
|
export function humanizeErrors (errors) {
|
||||||
return reduce(errors, (errs, val, k) => {
|
return Object.entries(errors).reduce((errs, [k, val]) => {
|
||||||
let message = reduce(val, (acc, message) => {
|
let message = val.reduce((acc, message) => {
|
||||||
let key = capitalize(k.replace(/_/g, ' '))
|
let key = capitalize(k.replace(/_/g, ' '))
|
||||||
return acc + [key, message].join(' ') + '. '
|
return acc + [key, message].join(' ') + '. '
|
||||||
}, '')
|
}, '')
|
||||||
|
|
Loading…
Reference in New Issue