UNPKG

@bonniernews/abbe-api-utils

Version:

Utilities for converting to Abbe article format

35 lines (34 loc) 893 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Puff { static initialize() { return new Puff(); } finalize() { if (!this.headLine) throw new Error("Puff must have a headline"); // Validate return { headLine: this.headLine, subheading: this.subheading, hasActiveImage: true, // Must be set so that it's not hidden by default if an image is added later ...(this.image ? { image: { uuid: this.image } } : {}), }; } setHeadLine(headLine) { this.headLine = headLine; return this; } setSubheading(subheading) { this.subheading = subheading; return this; } setImage(image) { this.image = image; return this; } build() { return this; } } exports.default = Puff;