UNPKG

@prismicio/mock

Version:

Generate mock Prismic documents, fields, Slices, and models for development and testing environments

30 lines (29 loc) 916 B
import { createFaker } from "../lib/createFaker.js"; import { image as image$1 } from "../model/image.js"; import { getMockImageData } from "../lib/getMockImageData.js"; import { buildImageFieldImage } from "../lib/buildImageFieldImage.js"; //#region src/value/image.ts const image = (config) => { const faker = config.faker || createFaker(config.seed); const model = config.model || image$1({ faker }); const imageData = getMockImageData({ faker }); const value = buildImageFieldImage({ faker, imageData, constraint: model.config?.constraint, state: config.state }); if (model.config?.thumbnails) for (const thumbnail of model.config.thumbnails) value[thumbnail.name] = buildImageFieldImage({ faker, imageData, constraint: { width: thumbnail.width, height: thumbnail.height }, state: config.state }); return value; }; //#endregion export { image }; //# sourceMappingURL=image.js.map