@tmlmobilidade/utils
Version:
A collection of utility functions and helpers for the TML Mobilidade Go monorepo, providing common functionality for batching operations, caching, HTTP requests, object manipulation, permissions, and more.
9 lines (8 loc) • 354 B
JavaScript
import { HttpException, HTTP_STATUS } from '@tmlmobilidade/consts';
export function validateQueryParams(queryParams, schema) {
const result = schema.safeParse(queryParams);
if (!result.success) {
throw new HttpException(HTTP_STATUS.BAD_REQUEST, result.error.errors.map(error => error.message).join(', '));
}
return result.data;
}