UNPKG

@fluent/langneg

Version:

Language Negotiation API for Fluent

8 lines (7 loc) 268 B
export function acceptedLanguages(str = "") { if (typeof str !== "string") { throw new TypeError("Argument must be a string"); } const tokens = str.split(",").map(t => t.trim()); return tokens.filter(t => t !== "").map(t => t.split(";")[0]); }