Risky Business: omit do when passing a 0 arg function to a function #22

Merged
probablycorey merged 13 commits from risky-business into main 2025-11-04 15:19:54 +00:00
Showing only changes of commit 67e0db090b - Show all commits

View File

@ -39,7 +39,7 @@ const tagCall = (tagName: string, atNamed = {}, ...args: any[]) => {
const space = attrs.length ? ' ' : ''
const children = args
.reverse()
.map(a => a === null ? buffer.pop() : a)
.map(a => a === TAG_TOKEN ? buffer.pop() : a)
.reverse().join(' ')
.replaceAll(` ${NOSPACE_TOKEN} `, '')
@ -50,13 +50,16 @@ const tagCall = (tagName: string, atNamed = {}, ...args: any[]) => {
}
const tag = async (tagName: string, atNamed = {}, ...args: any[]) => {
if (typeof args[0] === 'function')
if (typeof args[0] === 'function') {
await tagBlock(tagName, atNamed, args[0])
else
} else {
tagCall(tagName, atNamed, ...args)
return TAG_TOKEN
}
}
const NOSPACE_TOKEN = '!!ribbit-nospace!!'
const TAG_TOKEN = '!!ribbit-tag!!'
const SELF_CLOSING = ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]
describe('ribbit', () => {