in src/shared/index.ts [54:68]
export function mapDistinct(pairs: [string, string][]): Map<string, string> {
const distinct = new Map<string, string | undefined>();
for (const [key, value] of pairs) {
if (distinct.has(key)) {
const otherValue = distinct.get(key);
if (value !== otherValue) distinct.set(key, undefined);
} else {
distinct.set(key, value);
}
}
for (const [key, value] of distinct) {
if (!value) distinct.delete(key);
}
return distinct as Map<string, string>;
}