import { imagePathsToProps } from 'vevet'; import { IBaseImageProps } from '../types'; interface IGetSrcProps extends Pick {} interface IGetSrcSetProps extends Pick {} export function getSrc({ paths, src }: IGetSrcProps) { if (paths) { return paths.thumb || paths.original; } return src; } export function getSrcSet({ srcSet, paths }: IGetSrcSetProps) { if (srcSet) { return srcSet; } if (!paths) { return undefined; } const imagePaths = paths ? imagePathsToProps(paths) : undefined; if (!imagePaths) { return undefined; } return imagePaths.srcSet || imagePaths.src; }