14nrv/vue-form-json

View on GitHub
src/helpers/index.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import slugify from 'slugify'
import { camelize } from 'humps'

export const slug = str => slugify(str.toLowerCase()) || str

export const camelizeKeys = (object) =>
  Object.entries(object).reduce(
    (acc, [key, value]) => ({ ...acc, [camelize(key)]: value }),
    {}
  )