2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-12 13:47:49 +00:00

Fix validating empty icon sets

This commit is contained in:
Vjacheslav Trushkin 2022-01-26 00:05:18 +02:00
parent 2e838b5ff4
commit 44a36fdf30

View File

@ -173,8 +173,17 @@ export function validateIconSet(
}
});
// Check not_found
if (data.not_found !== void 0 && !(data.not_found instanceof Array)) {
if (fix) {
delete data.not_found;
} else {
throw new Error('Invalid not_found list');
}
}
// Make sure icons list is not empty
if (!Object.keys(data.icons).length) {
if (!Object.keys(data.icons).length && !data.not_found?.length) {
throw new Error('Icon set is empty');
}