UNPKG

succulent

Version:

Powerful and easy runtime type checking

19 lines 543 B
import { Schema } from "../schema"; export function $Array(base) { const itemSchema = Schema.from(base); const baseDisplayName = itemSchema.displayName; return new Schema((t) => { if (!Array.isArray(t)) { return false; } for (const each of t) { itemSchema.check(each); } return true; }, { displayName: baseDisplayName.includes(" ") ? `${baseDisplayName}[]` : `Array<${baseDisplayName}>`, }); } //# sourceMappingURL=array.js.map