INNER CODE UNIT · TypeScript

clipText

Hash-Studios/Prism · infra/cloudflare/worker/src/index.ts:682

function clipText(value: string, max: number): string {
  if (value.length <= max) {
    return value;
  }
  return `${value.slice(0, Math.max(0, max - 1))}…`;
}

function sanitizeImageUrl(value: string): string {
  if (!isNonEmptyString(value)) {
    return '';
  }
  try {
    const parsed = new URL(value);
    if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
      return '';
    }
    return parsed.toString();
  } catch {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…