express-serve-static-core#Query TypeScript Examples
The following examples show how to use
express-serve-static-core#Query.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: listHelpers.ts From lighthouse-audit-service with Apache License 2.0 | 6 votes |
export function listOptionsFromQuery(
query: Query,
defaultLimit = 25,
defaultOffset = 0,
): ListRequest {
const { limit: limitStr = defaultLimit, offset: offsetStr = defaultOffset } =
query;
const limit = +limitStr;
const offset = +offsetStr;
if (isNaN(limit)) throw new InvalidRequestError(`limit must be a number.`);
if (isNaN(offset)) throw new InvalidRequestError(`offset must be a number.`);
return { limit, offset };
}