queryParams.ts — astro Source File
Architecture documentation for queryParams.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR dc93ef0b_a211_f787_49df_98618159d12b["queryParams.ts"] 416eda3d_47e6_c298_102b_b7a37d86a44e["../../assets/types.js"] dc93ef0b_a211_f787_49df_98618159d12b --> 416eda3d_47e6_c298_102b_b7a37d86a44e style dc93ef0b_a211_f787_49df_98618159d12b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { ImageInputFormat, ImageMetadata } from '../types.js';
/**
* Extracts the original image query parameters (width, height, format) from the given `URLSearchParams` object
* and returns them as an object. If any of the required parameters are missing or invalid, the function returns undefined.
*
* The `width` and `height` are parsed to integer values.
*
* @param {URLSearchParams} params - The `URLSearchParams` object containing the query parameters.
* @return {Pick<ImageMetadata, 'width' | 'height' | 'format'> | undefined} An object with the original image parameters (width, height, format) or undefined if any parameter is missing.
*/
export function getOrigQueryParams(
params: URLSearchParams,
): Pick<ImageMetadata, 'width' | 'height' | 'format'> | undefined {
const width = params.get('origWidth');
const height = params.get('origHeight');
const format = params.get('origFormat');
if (!width || !height || !format) {
return undefined;
}
return {
width: parseInt(width),
height: parseInt(height),
format: format as ImageInputFormat,
};
}
Domain
Subdomains
Functions
Dependencies
- ../../assets/types.js
Source
Frequently Asked Questions
What does queryParams.ts do?
queryParams.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in queryParams.ts?
queryParams.ts defines 1 function(s): getOrigQueryParams.
What does queryParams.ts depend on?
queryParams.ts imports 1 module(s): ../../assets/types.js.
Where is queryParams.ts in the architecture?
queryParams.ts is located at packages/astro/src/assets/utils/queryParams.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/assets/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free