2022-02-27 02:06:33 +00:00
|
|
|
"use strict";
|
|
|
|
|
2022-03-11 01:29:47 +00:00
|
|
|
export default function(def, fixed_width=true, aria_hidden=true) {
|
2022-02-27 02:06:33 +00:00
|
|
|
if(typeof def === "string")
|
2022-03-11 01:29:47 +00:00
|
|
|
return `span[class="fa fa-${def}${fixed_width?` fa-fw`:``}"${aria_hidden?` aria-hidden="true"`:""}]`;
|
2022-02-27 02:06:33 +00:00
|
|
|
if(def instanceof Array)
|
2022-03-11 01:29:47 +00:00
|
|
|
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(`+`)})`;
|
2022-02-27 02:06:33 +00:00
|
|
|
|
|
|
|
throw new Error(`Error: Expected def of type string or Array, but got variable of type ${typeof def}`);
|
|
|
|
}
|