UNPKG

@datocms/cma-client

Version:
20 lines 754 B
export function isBlockOfType(itemTypeId, ...rest) { const check = (block) => { if (typeof block !== 'object' || block === null) return false; const relationships = block.relationships; if (typeof relationships !== 'object' || relationships === null) return false; const itemType = relationships.item_type; if (typeof itemType !== 'object' || itemType === null) return false; const data = itemType.data; if (typeof data !== 'object' || data === null) return false; return data.id === itemTypeId; }; if (rest.length > 0) return check(rest[0]); return (block) => check(block); } //# sourceMappingURL=isBlockOfType.js.map