Skip to content

Instantly share code, notes, and snippets.

@TheDome0
Created November 16, 2022 18:43
Show Gist options
  • Select an option

  • Save TheDome0/f7760be6fd95f5cb25c3701a04b8c7aa to your computer and use it in GitHub Desktop.

Select an option

Save TheDome0/f7760be6fd95f5cb25c3701a04b8c7aa to your computer and use it in GitHub Desktop.
create = (properties = {}, children = [], attrs = {}) => children.reduce((e, curr) => (e.appendChild(curr), e), Object.entries(attrs).reduce((e, [k, v]) => (e.setAttribute(k, v), e), Object.assign(document.createElement(properties.tag), properties)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment