10 lines
565 B
JavaScript
10 lines
565 B
JavaScript
"use strict";
|
|
|
|
export default function(def, fixed_width=true, aria_hidden=true) {
|
|
if(typeof def === "string")
|
|
return `span[class="fa fa-${def}${fixed_width?` fa-fw`:``}"${aria_hidden?` aria-hidden="true"`:""}]`;
|
|
if(def instanceof Array)
|
|
return `(span[class="fa-stack${fixed_width?` fa-fw`:``}"${aria_hidden?` aria-hidden="true"`:""}]>${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}`);
|
|
}
|