diff --git a/src/lib/utils/functions.ts b/src/lib/utils/functions.ts index 5808346..53586a7 100644 --- a/src/lib/utils/functions.ts +++ b/src/lib/utils/functions.ts @@ -77,6 +77,10 @@ export function randomString() { return Math.random().toString(36).substring(2, 9); } +export function isJustOne(list: T[]): list is [T] { + return list.length === 1; +} + export function trackByFactory, PrimaryKey extends Id = T['id']>() { return (_index: number, item: T): Id => item.id; }