Skip to content

Commit

Permalink
Check if path is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore committed Sep 5, 2024
1 parent 144211b commit 7db0980
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/viewbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import { getIconSize, resetIconPosition } from '../source/icon.ts';
const checkAutoViewboxPath = (icon: si.SimpleIcon) => {
const start = performance.now();
try {
const { path } = icon;
const { width, height } = getIconSize(path);
resetIconPosition(
path,
const { width, height } = getIconSize(icon.path);
const { path } = resetIconPosition(
icon.path,
width,
height,
);
const end = performance.now();
return { title: icon.title, time: end - start };
if (path) {
return { title: icon.title, time: end - start };
}
throw new Error('Path is empty');
} catch (e) {
const end = performance.now();
console.error(`Error in icon: ${icon.title}: ${e.message}`);
Expand Down

0 comments on commit 7db0980

Please sign in to comment.