Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 5x 1x 2x 2x 2x 1x 1x 2x 2x | export function parseAcceptLanguage(acceptLanguage = ""): string[] {
const languages = acceptLanguage.split(",").map((lang) => {
const [code, q = "1"] = lang.trim().split(";q=");
const baseCode = code.split("-")[0];
return { code: baseCode.trim(), q: parseFloat(q) };
});
return languages
.toSorted((a, b) => b.q - a.q)
.map(({ code }) => code)
.filter((code, index, self) => self.indexOf(code) === index);
}
|