removed excess comments

This commit is contained in:
2026-01-04 11:14:54 -05:00
parent b81de6441b
commit 7e89e6dda2
68 changed files with 72 additions and 941 deletions

View File

@@ -4,11 +4,7 @@
*/
/**
* Safe fetch wrapper that suppresses console errors for expected 401 responses
* Use this instead of direct fetch() calls when 401s are expected (e.g., auth checks)
* @param input - URL or Request object
* @param init - Fetch options
* @returns Promise<Response>
* Fetch wrapper for auth checks where 401s are expected and should not trigger console errors
*/
export async function safeFetch(
input: RequestInfo | URL,
@@ -18,17 +14,12 @@ export async function safeFetch(
const response = await fetch(input, init);
return response;
} catch (error) {
// Re-throw the error - this is for actual network failures
throw error;
}
}
/**
* Inserts soft hyphens (&shy;) into long words to enable manual hyphenation
* Works with Typewriter component since it uses actual characters
* @param text - The text to add hyphens to
* @param minWordLength - Minimum word length to hyphenate (default 8)
* @returns Text with soft hyphens inserted
* Inserts soft hyphens (&shy;) for manual hyphenation. Uses actual characters for Typewriter compatibility.
*/
export function insertSoftHyphens(
text: string,
@@ -37,26 +28,20 @@ export function insertSoftHyphens(
return text
.split(" ")
.map((word) => {
// Skip short words
if (word.length < minWordLength) return word;
// Common English hyphenation patterns
const patterns = [
// Prefixes (break after)
{
pattern:
/^(un|re|in|dis|en|non|pre|pro|anti|de|mis|over|sub|super|trans|under)(.+)/i,
split: 1
},
// Suffixes (break before)
{
pattern:
/(.+)(ing|tion|sion|ness|ment|able|ible|ful|less|ship|hood|ward|like)$/i,
split: 1
},
// Double consonants (break between)
{ pattern: /(.+[aeiou])([bcdfghjklmnpqrstvwxyz])\2(.+)/i, split: 2 },
// Compound words with common parts
{
pattern:
/(.+)(stand|work|time|place|where|thing|back|over|under|out)$/i,
@@ -68,16 +53,13 @@ export function insertSoftHyphens(
const match = word.match(pattern);
if (match) {
if (split === 1) {
// Break after first capture group
return match[1] + "\u00AD" + match[2];
} else if (split === 2) {
// Break between doubled consonants
return match[1] + match[2] + "\u00AD" + match[2] + match[3];
}
}
}
// Fallback: Insert soft hyphen every 6-8 characters in very long words
if (word.length > 12) {
const chunks: string[] = [];
for (let i = 0; i < word.length; i += 6) {