UNPKG

nuxt-og-image

Version:

Enlightened OG Image generation for Nuxt.

25 lines (24 loc) 655 B
export function walkSatoriTree(e, node, plugins) { const promises = []; if (!node.props?.children || !Array.isArray(node.props.children)) return promises; if (node.props.children.length === 0) { delete node.props.children; return promises; } for (const child of node.props.children || []) { if (child) { for (const plugin of plugins.flat()) { if (plugin.filter(child)) promises.push(plugin.transform(child, e)); } promises.push( ...walkSatoriTree(e, child, plugins) ); } } return promises; } export function defineSatoriTransformer(transformer) { return transformer; }