mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: apply feedback
This commit is contained in:
parent
f4ca6613c7
commit
bac3597614
@ -9,13 +9,5 @@
|
||||
export const validateUniqueFields = <T>(
|
||||
fields: T[],
|
||||
fieldName: keyof T,
|
||||
): boolean => {
|
||||
if (!Array.isArray(fields)) return false;
|
||||
const seen = new Set<string>();
|
||||
return fields.every((f) => {
|
||||
const fieldValue = f[fieldName] as string;
|
||||
if (seen.has(fieldValue)) return false;
|
||||
seen.add(fieldValue);
|
||||
return true;
|
||||
});
|
||||
};
|
||||
): boolean =>
|
||||
new Set(fields.map((f) => f[fieldName] as string)).size === fields.length;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user