systemquery/src/static/js/ui/forkawesome_emel.mjs

11 lines
469 B
JavaScript
Raw Normal View History

"use strict";
export default function(def, fixed_width=true) {
if(typeof def === "string")
return `span[class="fa fa-${def}${fixed_width?` fa-fw`:``}"]`;
if(def instanceof Array)
return `(span[class="fa-stack${fixed_width?` fa-fw`:``}"]>${def.map((el, i) => `span[class="fa fa-${el} fa-stack-${def.length-i}x${fixed_width?` fa-fw`:``}"]`).join(`+`)})`;
throw new Error(`Error: Expected def of type string or Array, but got variable of type ${typeof def}`);
}