@mintlify/common
Version:
Commonly shared code within Mintlify
17 lines (16 loc) • 572 B
JavaScript
export function buildMetaAttributes(meta) {
const attributes = [];
for (const [key, value] of Object.entries(meta)) {
if (typeof value === 'boolean' || typeof value === 'number' || typeof value === 'string') {
attributes.push({ type: 'mdxJsxAttribute', name: key, value: value.toString() });
}
else if (Array.isArray(value)) {
attributes.push({
type: 'mdxJsxAttribute',
name: key,
value: JSON.stringify(value),
});
}
}
return attributes;
}