This commit is contained in:
Horis
2025-12-04 10:21:21 +08:00
parent 842e52bd6f
commit 3a5f713f1c
3 changed files with 22 additions and 6 deletions
+16 -1
View File
@@ -49,12 +49,27 @@ export const convertSourcesToMap = (sources: Source[]): Map<string, Source> => {
return map
}
export const normalizeSource = (source: any) => {
for (const key in source) {
const value = source[key]
if (
value === '' ||
value === null ||
(typeof value === 'string' && !value.trim())
) {
delete source[key]
} else if (value instanceof Object) {
normalizeSource(value)
}
}
}
export const emptyBookSource = {
ruleSearch: {},
ruleBookInfo: {},
ruleToc: {},
ruleContent: {},
ruleReview: {},
// ruleReview: {},
ruleExplore: {},
} as BookSoure
export const emptyRssSource = {} as RssSource