dk-plus
Version:
14 lines (13 loc) • 337 B
JavaScript
const o = (t = 0) => {
let n = t.toString();
if (typeof t == "number" && !isNaN(t))
n = `${t}px`;
else if (typeof t == "string")
["px", "em", "rem", "vh", "vw", "%"].some((e) => n.includes(e)) || (n += "px");
else
throw new Error(`dk-plus -> getSize -> ${n} is not a size`);
return n;
};
export {
o as setSize
};