hyperscript-attribute-to-property

1.0.2 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    43,669
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    43,669
  • 1.0.1
    167
  • 1.0.0
    174

Package Sidebar

Install

npm i hyperscript-attribute-to-property

Weekly Downloads

37,043

Version

1.0.2

License

MIT

Unpacked Size

4.25 kB

Total Files

4

Last publish

Collaborators

  • feross