Add unique

This commit is contained in:
Sergey Dolin 2023-06-06 15:01:39 +02:00
parent 885f6b5c36
commit b8b9502971
4 changed files with 148 additions and 16 deletions

View file

@ -61,3 +61,12 @@ async function getToolVersion(tool: string, options: string[]) {
return '';
}
}
export const unique = () => {
const encountered = new Set();
return (value: unknown): boolean => {
if (encountered.has(value)) return false;
encountered.add(value);
return true;
};
};