@scalar/api-client
Version:
the open source API testing client
34 lines (33 loc) • 889 B
JavaScript
import { snippetz as l } from "@scalar/snippetz";
import { capitalize as o } from "vue";
const y = (t) => `custom/${t.lang}`, m = (t) => t === !0 ? [] : l().clients().flatMap((e) => {
const n = e.clients.flatMap((r) => {
const c = `${e.key}/${r.client}`;
if (Array.isArray(t) && t.includes(r.client))
return [];
if (typeof t == "object" && t !== null) {
const i = t[e.key];
if (i === !0)
return [];
if (Array.isArray(i) && i.includes(r.client))
return [];
}
return {
id: c,
lang: r.client === "curl" ? "curl" : e.key,
title: `${o(e.title)} ${r.title}`,
label: r.title,
targetKey: e.key,
targetTitle: e.title,
clientKey: r.client
};
});
return n.length === 0 ? [] : {
label: e.title,
options: n
};
});
export {
m as generateClientOptions,
y as generateCustomId
};