Skip to content

Commit

Permalink
fix(Constants): allow undefined size (#6686)
Browse files Browse the repository at this point in the history
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
  • Loading branch information
ImRodry and vladfrangu committed Sep 26, 2021
1 parent f8aa4bd commit d3da833
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/Constants.js
Expand Up @@ -19,7 +19,7 @@ const AllowedImageFormats = ['webp', 'png', 'jpg', 'jpeg', 'gif'];
const AllowedImageSizes = Array.from({ length: 9 }, (e, i) => 2 ** (i + 4));

function makeImageUrl(root, { format = 'webp', size } = {}) {
if (typeof size !== 'number') throw new TypeError('INVALID_TYPE', 'size', 'number');
if (!['undefined', 'number'].includes(typeof size)) throw new TypeError('INVALID_TYPE', 'size', 'number');
if (format && !AllowedImageFormats.includes(format)) throw new Error('IMAGE_FORMAT', format);
if (size && !AllowedImageSizes.includes(size)) throw new RangeError('IMAGE_SIZE', size);
return `${root}.${format}${size ? `?size=${size}` : ''}`;
Expand Down

0 comments on commit d3da833

Please sign in to comment.