UNPKG

@wordpress/block-library

Version:
21 lines (20 loc) • 581 B
import { registerBlockType } from "@wordpress/blocks"; // packages/block-library/src/utils/init-block.js /** * Function to register an individual block. * * @param {Object} block The block to be registered. * * @return {WPBlockType | undefined} The block, if it has been successfully registered; * otherwise `undefined`. */ function initBlock(block) { if (!block) return; const { metadata, settings, name } = block; return registerBlockType({ name, ...metadata }, settings); } export { initBlock as default }; //# sourceMappingURL=init-block.mjs.map