Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jun 10, 2024
1 parent 3e82b86 commit fbeaa3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 3 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ function setAttributes(image: HTMLImageElement, attributes: Attributes): void {
}
}

function lazyPromise<Image = HTMLImageElement>(fn: () => Promise<Image>): () => Promise<Image> {
function lazyPromise<Image = HTMLImageElement>(function_: () => Promise<Image>): () => Promise<Image> {
let promise: Promise<Image> | undefined;
return () => {
if (!promise) {
promise = fn();
}
promise ??= function_();

return promise;
};
Expand All @@ -41,7 +39,7 @@ function load(image: HTMLImageElement): Result {

if (image.complete) {
// If the image is complete but the naturalWidth is 0px it's probably broken
reject(image);
reject(new Error('Unable to load image metadata'));
clearInterval(interval);
return true;
}
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
}
},
"devDependencies": {
"@sindresorhus/tsconfig": "^3.0.1",
"type-fest": "^3.10.0",
"typescript": "^5.0.4",
"xo": "^0.54.2"
"@sindresorhus/tsconfig": "^5.0.0",
"type-fest": "^4.20.0",
"typescript": "^5.4.5",
"vitest": "^1.6.0",
"xo": "^0.58.0"
}
}

0 comments on commit fbeaa3e

Please sign in to comment.