UNPKG

aurelia-fontawesome

Version:

Aurelia wrapper around the font awesome 5 library

21 lines (20 loc) 678 B
function convert(createElement, element) { var children = (element.children || []).map(function (child) { if (typeof child === "string") { return child; } return convert(createElement, child); }); var $el = createElement(element.tag); if (element.attributes) { for (var _i = 0, _a = Object.keys(element.attributes); _i < _a.length; _i++) { var attr = _a[_i]; $el.setAttribute(attr, element.attributes[attr]); } } children.forEach(function (c) { return typeof c === "string" ? ($el.textContent = c) : $el.appendChild(c); }); return $el; } export default convert;