@mitcsutt/kiln-forms
Version:
Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui
20 lines (19 loc) • 996 B
JavaScript
//#region src/kit/accepts.ts
var e = (e) => e == null, t = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean";
function n(e) {
return typeof File < "u" && e instanceof File || typeof e == "object" && !!e && typeof e.id == "string" && typeof e.name == "string";
}
var r = {
string: (t) => e(t) || typeof t == "string",
numberOrNull: (t) => e(t) || typeof t == "number" && !Number.isNaN(t),
boolean: (t) => e(t) || typeof t == "boolean",
primitiveOrNull: (n) => e(n) || t(n),
arrayOfPrimitive: (n) => e(n) || Array.isArray(n) && n.every(t),
stringArray: (t) => e(t) || Array.isArray(t) && t.every((e) => typeof e == "string"),
files: (t) => e(t) || Array.isArray(t) && t.every(n),
tuple2: (t) => e(t) || Array.isArray(t) && t.length === 2 && t.every((e) => typeof e == "number"),
dateRange: (t) => e(t) || typeof t == "object" && typeof t.start == "string" && typeof t.end == "string"
};
//#endregion
export { r as accepts };
//# sourceMappingURL=accepts.js.map