pagamio-frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
22 lines (21 loc) • 636 B
JavaScript
export const createQueryConfig = (startDate, endDate, options, filters) => {
return {
startDate,
endDate,
filters,
metrics: options.metrics ?? [],
aggregationType: options.aggregationType ?? 'SUM',
dimensions: options.dimensions,
limit: options.limit,
sortBy: options.sortBy,
sortDirection: options.sortDirection,
page: options.page,
size: options.size,
};
};
/**
* Helper function to get nested object value by path
*/
export const getNestedValue = (obj, path) => {
return path.split('.').reduce((acc, part) => acc?.[part], obj);
};