aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/helpers/images.ts
blob: bff50c3c4e9c0cf782d0ed3c9c619f50e57d7140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Image } from '../../types/app';
import { RawCover } from '../../types/raw-data';

/**
 * Retrieve an Image object from raw data.
 *
 * @param image - The cover raw data.
 * @returns {Image} - An Image object.
 */
export const getImageFromRawData = (image: RawCover): Image => {
  return {
    alt: image.altText,
    height: image.mediaDetails.height,
    src: image.sourceUrl,
    title: image.title,
    width: image.mediaDetails.width,
  };
};