import keys from 'lodash.keys' ; import snakeCase from 'lodash.snakecase' ; export const propertiesToSnakeCase = ( object , bodyParams ? ) => { const updatedObject = { } ; const objectKeys = keys ( object ) ; objectKeys . forEach ( ( key ) => { const value = object [ key ] ; if ( Array . isArray ( value ) && ! bodyParams ) { updatedObject [ snakeCase ( key ) ] = value . join ( ) ; } else updatedObject [ snakeCase ( key ) ] = value ; } ) ; return updatedObject ; } ;