MCPcopy Index your code
hub / github.com/unpkg/unpkg / normalizeSearch

Function normalizeSearch

packages/unpkg-esm/src/request-handler.ts:559–575  ·  view source on GitHub ↗
(searchParams: URLSearchParams)

Source from the content-addressed store, hash-verified

557}
558
559function normalizeSearch(searchParams: URLSearchParams): string {
560 let entries = Array.from(searchParams.entries()).sort(([leftName, leftValue], [rightName, rightValue]) => {
561 if (leftName === rightName) {
562 return leftValue.localeCompare(rightValue);
563 }
564
565 return leftName.localeCompare(rightName);
566 });
567 let normalized = new URLSearchParams();
568
569 for (let [name, value] of entries) {
570 normalized.append(name, value);
571 }
572
573 let search = normalized.toString();
574 return search === "" ? "" : `?${search}`;
575}
576
577function jsonError(error: EsmRequestError | { code: string; message: string; status: number }): Response {
578 return Response.json(

Callers 3

handleRequestFunction · 0.85
createMetadataFunction · 0.85
getBuildIntegrityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected