mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
feat(v4): Add new conversation filters component (#10502)
Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
25
app/javascript/dashboard/composables/useTransformKeys.js
Normal file
25
app/javascript/dashboard/composables/useTransformKeys.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// NOTE: In the future if performance becomes an issue, we can memoize the functions
|
||||
|
||||
import { unref } from 'vue';
|
||||
import camelcaseKeys from 'camelcase-keys';
|
||||
import snakecaseKeys from 'snakecase-keys';
|
||||
|
||||
/**
|
||||
* Vue composable that converts object keys to camelCase
|
||||
* @param {Object|Array|import('vue').Ref<Object|Array>} payload - Object or array to convert
|
||||
* @returns {Object|Array} Converted payload with camelCase keys
|
||||
*/
|
||||
export function useCamelCase(payload) {
|
||||
const unrefPayload = unref(payload);
|
||||
return camelcaseKeys(unrefPayload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vue composable that converts object keys to snake_case
|
||||
* @param {Object|Array|import('vue').Ref<Object|Array>} payload - Object or array to convert
|
||||
* @returns {Object|Array} Converted payload with snake_case keys
|
||||
*/
|
||||
export function useSnakeCase(payload) {
|
||||
const unrefPayload = unref(payload);
|
||||
return snakecaseKeys(unrefPayload);
|
||||
}
|
||||
Reference in New Issue
Block a user