minor fixes
This commit is contained in:
@@ -19,4 +19,15 @@ export const intervals = {
|
||||
month: "Month",
|
||||
};
|
||||
|
||||
export const alphabetIds = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"] as const;
|
||||
export const alphabetIds = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"] as const;
|
||||
|
||||
export const timeRanges = {
|
||||
'today': 'Today',
|
||||
1: '24 hours',
|
||||
7: '7 days',
|
||||
14: '14 days',
|
||||
30: '30 days',
|
||||
90: '3 months',
|
||||
180: '6 months',
|
||||
365: '1 year',
|
||||
}
|
||||
@@ -1,16 +1,24 @@
|
||||
|
||||
export function toDots(obj: Record<string, unknown>, path = ''): Record<string, number | string | boolean> {
|
||||
export function toDots(
|
||||
obj: Record<string, unknown>,
|
||||
path = "",
|
||||
): Record<string, number | string | boolean> {
|
||||
return Object.entries(obj).reduce((acc, [key, value]) => {
|
||||
if(typeof value === 'object' && value !== null) {
|
||||
if (typeof value === "object" && value !== null) {
|
||||
return {
|
||||
...acc,
|
||||
...toDots(value as Record<string, unknown>, `${path}${key}.`)
|
||||
}
|
||||
...toDots(value as Record<string, unknown>, `${path}${key}.`),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...acc,
|
||||
[`${path}${key}`]: value,
|
||||
}
|
||||
}, {})
|
||||
}
|
||||
};
|
||||
}, {});
|
||||
}
|
||||
|
||||
export function entries<K extends string | number | symbol, V>(
|
||||
obj: Record<K, V>,
|
||||
): [K, V][] {
|
||||
return Object.entries(obj) as [K, V][];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user