11 lines
No EOL
434 B
TypeScript
Executable file
11 lines
No EOL
434 B
TypeScript
Executable file
type Size = '1x' | '2x' | '3x'
|
|
const allSizes : Size[] = ['1x', '2x', '3x']
|
|
|
|
export const getImage =
|
|
(path: string, img: string) => (size: Size, set: boolean) =>
|
|
`${path}${img}@${size}.webp${set ? ` ${size}` : ''}`;
|
|
|
|
export const getImageSet = (path: string, img: string) =>
|
|
allSizes.map((size) => getImage(path, img)(size, true))
|
|
|
|
export const getInitialImage = (path: string, img: string) => getImage(path, img)('1x', false) |