Upgrade dependencies and migrate from Joi to Zod for validation
This commit is contained in:
parent
4fa0190e4b
commit
a26d0c77a1
12 changed files with 498 additions and 287 deletions
|
@ -1,19 +0,0 @@
|
|||
import Joi from "joi";
|
||||
|
||||
export const isValidationError = (
|
||||
error: unknown
|
||||
): error is Joi.ValidationError => error instanceof Joi.ValidationError;
|
||||
|
||||
export const isValue = <T>(value: T | Array<T> | undefined): value is T =>
|
||||
!!value && !Array.isArray(value);
|
||||
|
||||
export const isSize = (value: unknown): value is string =>
|
||||
!Array.isArray(value) &&
|
||||
!isNaN(parseInt(value as string)) &&
|
||||
parseInt(value as string) <= 512 &&
|
||||
parseInt(value as string) >= 16;
|
||||
|
||||
export const isStyle =
|
||||
(validStyles: string[]) =>
|
||||
<T>(value: T | Array<T> | undefined): value is T =>
|
||||
!!value && !Array.isArray(value) && validStyles.includes(value as string);
|
Loading…
Add table
Add a link
Reference in a new issue