laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
31 lines (30 loc) • 702 B
JavaScript
"use client";
const f = {};
function l(t, o) {
const n = f, e = typeof n.includeImageAlt == "boolean" ? n.includeImageAlt : !0, r = typeof n.includeHtml == "boolean" ? n.includeHtml : !0;
return c(t, e, r);
}
function c(t, o, n) {
if (s(t)) {
if ("value" in t)
return t.type === "html" && !n ? "" : t.value;
if (o && "alt" in t && t.alt)
return t.alt;
if ("children" in t)
return i(t.children, o, n);
}
return Array.isArray(t) ? i(t, o, n) : "";
}
function i(t, o, n) {
const e = [];
let r = -1;
for (; ++r < t.length; )
e[r] = c(t[r], o, n);
return e.join("");
}
function s(t) {
return !!(t && typeof t == "object");
}
export {
l as toString
};