MCPcopy Create free account
hub / github.com/dailydotdev/apps / sanitizeParam

Function sanitizeParam

packages/webapp/lib/squadsCreatePrefill.ts:17–32  ·  view source on GitHub ↗
(
  value: string | string[] | undefined,
  maxLength?: number,
)

Source from the content-addressed store, hash-verified

15}
16
17const sanitizeParam = (
18 value: string | string[] | undefined,
19 maxLength?: number,
20): string | undefined => {
21 const trimmed = getFirstQueryParam(value)?.trim();
22
23 if (!trimmed) {
24 return undefined;
25 }
26
27 if (!maxLength) {
28 return trimmed;
29 }
30
31 return trimmed.slice(0, maxLength);
32};
33
34const hasValue = (value?: string): boolean => !!value?.trim();
35

Callers 1

Calls 1

getFirstQueryParamFunction · 0.90

Tested by

no test coverage detected