MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / MaybeArray

Function MaybeArray

framework/framework/validator.ts:12–12  ·  view source on GitHub ↗
(inner: Schema<T>)

Source from the content-addressed store, hash-verified

10export type Type<T> = Schema<T> | readonly [Converter<T>, Validator<false>?, (boolean | 'convert')?];
11
12const MaybeArray = <T>(inner: Schema<T>) => Schema.union([Schema.array(inner), inner]);
13type CheckFunction = <IsNumber extends boolean>(v: IsNumber extends true ? number : string) => boolean;
14const ArrayBase = <IsNumber extends boolean>(check: CheckFunction, number: IsNumber, doSplit: boolean = number) => Schema.transform(
15 MaybeArray(Schema.union([Number, String])),

Callers 1

ArrayBaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected