LookAtMySuitBot/js/node_modules/jose/dist/browser/lib/is_disjoint.js

23 lines
594 B
JavaScript
Raw Normal View History

2023-12-24 20:08:39 -05:00
const isDisjoint = (...headers) => {
const sources = headers.filter(Boolean);
if (sources.length === 0 || sources.length === 1) {
return true;
}
let acc;
for (const header of sources) {
const parameters = Object.keys(header);
if (!acc || acc.size === 0) {
acc = new Set(parameters);
continue;
}
for (const parameter of parameters) {
if (acc.has(parameter)) {
return false;
}
acc.add(parameter);
}
}
return true;
};
export default isDisjoint;