The Latest

2d Ev

Server-side hscrpt.

This needs to account for self-closing tags in the next version, but otherwise seems to work.

const h = (f, a, c) => {
  let attrs = ''
  if (Array.isArray(a)) { c = a }
  else {
    attrs += Object.keys(a).map(prop => {
      const k = a[prop]
      if (prop === 'classList') { prop = 'class'}
      return ` ${prop}="${k}"`
    }).join('')
  }
  return `<${f}${attrs}>${[...c].join('')}</${f}>`
}

console.log(h('span', {classList: 'some', id: 'thing'}, ['Yo', ' ', h('bold', ['World'])]))
// <span class="some" id="thing">Yo <bold>World</bold></span>
console.log(h('p', ['Hello World']))
// <p>Hello World</p>
More on Wiredove →

Everett Bogue

📧 ev@evbogue.com

📱 773-510-8601

🕊 ev

🦋 evbogue.com

evbogue