Hyperlinkv0.8.0-beta.28

Schema

Schema.UniqueArrayfunctioneffect/Schema.ts:4638
UniqueArray<S>

Returns a new array schema that ensures all elements are unique.

Details

The equivalence used to determine uniqueness is the one provided by Schema.toEquivalence(item).

constructors
Source effect/Schema.ts:463818 lines
export interface UniqueArray<S extends Constraint> extends $Array<S> {
  readonly "Rebuild": UniqueArray<S>
}

/**
 * Returns a new array schema that ensures all elements are unique.
 *
 * **Details**
 *
 * The equivalence used to determine uniqueness is the one provided by
 * `Schema.toEquivalence(item)`.
 *
 * @category constructors
 * @since 4.0.0
 */
export function UniqueArray<S extends Constraint>(item: S): UniqueArray<S> {
  return ArraySchema(item).check(isUnique())
}