Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 26x 26x 36x 36x 117x 26x 16x 16x 81x 13x 13x 16x | import { TDocument } from "../types";
const VALID_FILE_EXTENSIONS = ["pdf", "jpg", "jpeg", "png", "webp"];
export const isValidExtension = (type?: string) => {
Iif (!type || typeof type !== "string") return false;
return VALID_FILE_EXTENSIONS.some((extension) =>
type.toLowerCase().includes(extension),
);
};
export const sanitizeList = (list: TDocument[]) => {
Iif (!Array.isArray(list)) return [];
const filteredList = list.filter((document) => {
if (document?.URL) return true;
Iif (!document?.name || !document?.type) return false;
return isValidExtension(document.type);
});
return filteredList;
};
|