コンテンツにスキップ
日本語

ExistsPredicate

このコンテンツはまだ日本語訳がありません。

ExistsPredicate = (candidate) => boolean

Defined in: src/util/RandomString.ts:62

Whether a drawn candidate is already taken — the while condition of the do/while loop that the exists argument replaces.

true means “draw again”. That polarity is what keeps a ! off the call site: randomUuid((id) => state.users.has(id)) reads as the loop it stands in for, where an accept-predicate would read as that loop’s negation.

It reads; it does not write. Nothing records the accepted candidate for you, so whatever exists consults is still the caller’s to update.

string

boolean