How to use the html-tags.reduce function in html-tags

To help you get started, we’ve selected a few html-tags examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dustinspecker / dscript / src / index.js View on Github external
attrsToPass = classesAndId
    }

    if (typeof classesAndId === 'string' && (classesAndId.indexOf('.') === 0 || classesAndId.indexOf('#') === 0)) {
      // case: div('.hello')
      objectAssign(attrsToPass, getClassesAndId(classesAndId))
    } else if (classesAndId !== undefined && typeof classesAndId !== 'object') {
      // case: div(2342374)
      childrenToPass = [classesAndId]
    }

    return createElement(tagOrComponent, attrsToPass, ...childrenToPass)
  }

  // attach each HTML creator function to a creator function for custom components
  return htmlTags.reduce((acc, tag) => {
    acc[tag] = creator(tag)

    return acc
  }, creator)
}

html-tags

List of standard HTML tags

MIT
Latest version published 1 month ago

Package Health Score

77 / 100
Full package analysis