1.0.2 • Published 9 months ago
jsn-utils v1.0.2
List of utility functions
noop(): void- A no-operation function that does nothingignorePromise(promise: Promise<any>): void- Helps to suppress unhandled promise rejectionschunk<T>(array: T[], size: number): T[][]- Splits array into chunks of the specified sizeisObjectEmpty(obj: object): boolean- Checks if the given object is empty (contains no own properties)wait(ms: number): Promise<void>- Returns a promise that resolves after the specified amount of time in millisecondsgetValidatedJSON(json: string|Jsonifiable, schema: ZodSchema)- Parses and validates a JSON string or an object against a specified Zod schema. Returns error as a third member of a returned tuple