object2html

1.1.0 • Public • Published

Object2HTML

logo

Convert the following formated object to a HTMLElement

{_:'tagname',//defaults to 'div' if not defined
    attr||a:{},//attributes
    prop||p:{},//properties
    event||e:{},//events
    child||c:[/*other objects*/]//childNodes
}

Usage

npm i object2html

Then import or require it in your code depends on your environment:

import {Object2HTML} from 'path/to/object2html';
//or
const {Object2HTML} = require('object2html');

Object2HTML(object[,func]);

  • object : The object to be converted to dom element, or a string(will be converted to a text node).
  • func : (optional) A function to be called after every element created, the parameter is the element.

Return the dom element.

Readme

Keywords

none

Package Sidebar

Install

npm i object2html

Weekly Downloads

2

Version

1.1.0

License

LGPL-3.0

Unpacked Size

9.88 kB

Total Files

4

Last publish

Collaborators

  • luojia