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

/**
 * 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,
  };
};