1.0.2 • Published 1 year ago

@itsfuad/fragmentbuilder v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Javascript object to HTML fragment

Json to HTML is a function that converts a JSON object to HTML document fragment. This fragment then can be directly used inside innerHTML.

example

const obj = {
 tag: 'div',
 text: 'Hello, World!',
 attr: {
  class: 'container',
  id: 'main'
 },
 childs: [
 {
  tag: 'h1',
  text: 'Hello, World!'
  },
 ]
}
const fragment = fragmentBuilder(obj);