INNER CODE UNIT · TypeScript
firstNonEmptyValue
Hash-Studios/Prism · infra/cloudflare/worker/src/index.ts:571
function firstNonEmptyValue(payload: Record<string, unknown>, keys: readonly string[]): string {
for (const key of keys) {
const value = payload[key];
if (isNonEmptyString(value)) {
return value.trim();
}
}
return '';
}
function decodeCanonicalSegment(value: string): string {
try {
const decoded = decodeURIComponent(value).trim();
return decoded;
} catch {
return '';
}
}