Files
clash-verge-rev/src/utils/ignore-case.ts
T

14 lines
343 B
TypeScript
Raw Normal View History

2022-03-28 00:56:48 +08:00
// Deep copy and change all keys to lowercase
2022-03-27 20:36:13 +08:00
type TData = Record<string, any>;
export default function ignoreCase(data: TData): TData {
if (!data) return data;
const newData = {} as TData;
2022-03-28 00:56:48 +08:00
Object.entries(data).forEach(([key, value]) => {
newData[key.toLowerCase()] = JSON.parse(JSON.stringify(value));
2022-03-27 20:36:13 +08:00
});
return newData;
}