mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
14 lines
333 B
TypeScript
14 lines
333 B
TypeScript
const validateImagesSize = (size: unknown): string => {
|
|
if (typeof size !== 'string') {
|
|
throw new TypeError('size must be a string.')
|
|
}
|
|
|
|
if (!size.includes('x') || size.split('x').length != 2) {
|
|
throw new Error("size must have two numbers separated with an 'x'")
|
|
}
|
|
|
|
return size
|
|
}
|
|
|
|
export default validateImagesSize
|