Risky Business: omit do when passing a 0 arg function to a function
#22
|
|
@ -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', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user