UNPKG

@codesled/content

Version:

Composable content blocks for Node.js apps — flexible, pluggable, and framework-agnostic.

23 lines (20 loc) 544 B
const BLOCK_TYPES = [ "text", "heading", "image", "code", "video", "quote", "divider", "embed", ]; function validateBlock(block) { if (!block || typeof block !== "object") throw new Error("Invalid block format."); if (!BLOCK_TYPES.includes(block.type)) throw new Error(`Unsupported block type: ${block.type}`); if (!("content" in block)) throw new Error("Block must have content."); return true; } module.exports = { BLOCK_TYPES, validateBlock, };