Use Array.reduce instead of lodash.reduce

This commit is contained in:
raeno 2018-12-05 01:58:38 +04:00
parent 822559afd8
commit 02e000b53e

View File

@ -1,8 +1,8 @@
import {capitalize, reduce} from 'lodash'
import { capitalize } from 'lodash'
export function humanizeErrors (errors) {
return reduce(errors, (errs, val, k) => {
let message = reduce(val, (acc, message) => {
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(' ') + '. '
}, '')