| 1 |
export type ShortcodeAtts = Record<string, unknown> |
| 2 |
|
| 3 |
export const buildShortcodeTag = (tag: string, atts: ShortcodeAtts): string => |
| 4 |
`[${[ |
| 5 |
tag, |
| 6 |
...Object.entries(atts) |
| 7 |
.filter(([, value]) => Boolean(value)) |
| 8 |
.map(([att, value]) => |
| 9 |
'boolean' === typeof value ? att : `${att}=${JSON.stringify(value)}`) |
| 10 |
].filter(Boolean).join(' ')}]` |
| 11 |
|