JSPM

hyperscript-attribute-to-property

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 84819
  • Score
    100M100P100Q169270F
  • License MIT

Convert hyperscript attributes to properties

Package Exports

  • hyperscript-attribute-to-property

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hyperscript-attribute-to-property) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hyperscript-attribute-to-property travis npm downloads javascript style guide

Convert hyperscript attributes to properties

Some html attributes have different JavaScript property names. The most annoying of these is class v.s. className.

With this package, you can do this:

var vnode = h('div', { class: 'my-class' })

Instead of this:

var vnode = h('div', { className: 'my-class' })

Works with virtual-dom, react, hyperscript, or any DOM builder with a hyperscript-style API: h(tagName, attrs, children).

install

npm install hyperscript-attribute-to-property

usage

example

var attrToProp = require('hyperscript-attribute-to-property')
var h = attrToProp(require('virtual-dom/h'))

hyperx

If you use the hyperx package, then this functionality is built-in and implemented via this package :)

license

MIT. Copyright (c) Feross Aboukhadijeh.