UNPKG

@datocms/cma-client

Version:
24 lines 895 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isBlockOfType = void 0; 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); } exports.isBlockOfType = isBlockOfType; //# sourceMappingURL=isBlockOfType.js.map