MCPcopy Create free account
hub / github.com/dfinity/orbit / parseLocationQuery

Function parseLocationQuery

apps/wallet/src/utils/helper.utils.ts:368–382  ·  view source on GitHub ↗
(query: LocationQuery)

Source from the content-addressed store, hash-verified

366 * @returns a record with string arrays.
367 */
368export const parseLocationQuery = (query: LocationQuery): Record<string, string[]> => {
369 const result: Record<string, string[]> = {};
370
371 for (const key in query) {
372 if (typeof query[key] === 'string' && query[key] !== '') {
373 result[key] = [query[key] as string];
374 } else if (Array.isArray(query[key]) && query[key]?.length) {
375 result[key] = compactArray<string>(query[key] as LocationQueryValue[], {
376 removeEmptyStrings: true,
377 });
378 }
379 }
380
381 return result;
382};
383
384/**
385 * Parses a value to a BigInt or returns undefined if the value is not a valid BigInt.

Callers 2

buildFiltersFunction · 0.90

Calls 1

compactArrayFunction · 0.85

Tested by

no test coverage detected