attrs

1.1.0 • Public • Published

attrs

Object as DOM attributes.

usage

var attrs = require('attrs');
var bool = true;
var input = document.createElement('input');
 
attrs(input, {
  id: 'input',
  checked: true,
  class: ['hello', 'world'],
  style : {
    top: 100 + 'px',
    bottom: 200 + 'px'
  },
  type: function() {
    return bool ? 'radio' : 'checkbox';
  }
})

Package Sidebar

Install

npm i attrs

Weekly Downloads

31

Version

1.1.0

License

MIT

Last publish

Collaborators

  • npm