Array overview

Added in v1.4.0


Table of contents


Combinators

Array

An array type of known values.

Signature

export declare const Array: <I, O>(codomain: Schema<I, O>, params?: ArrayParams | undefined) => ArraySchema<I, O>

Added in v1.0.0

Transformations

ArraySchema (class)

The ArraySchema schema transformer, to construct an ArraySchema use S.Array combinator instead.

Signature

export declare class ArraySchema<I, O> {
  constructor(private readonly codomain: Schema<I, O>, private readonly params: ArrayParams = {})
}

Added in v2.2.0

minLength (property)

Requires a minimum array length

Returns a new ArraySchema

Signature

readonly minLength: (minLength: number) => ArraySchema<I, O>

Added in v2.2.0

maxLength (property)

Requires a maximum array length

Returns a new ArraySchema

Signature

readonly maxLength: (maxLength: number) => ArraySchema<I, O>

Added in v2.2.0

nonEmpty (property)

Converts an array schema to a non-empty array schema

Returns a new Schema

Signature

readonly nonEmpty: () => Schema<RNEA.ReadonlyNonEmptyArray<I>, RNEA.ReadonlyNonEmptyArray<O>>

Added in v2.2.0