String Normalization Helpers (shared/stringNormalization.ts)

LoopTroop · shared/stringNormalization.ts · typescript · MIT
dev-tools, tag:string, tag:normalization, tag:utility

Utility functions to normalize strings, including coercion and trimming.

// Source: https://github.com/looptroop-ai/LoopTroop | License: MIT | Copyright 2026 LoopTroop AI
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * String coercion helpers that were written out by hand in five modules.
 *
 * The three array variants are deliberately separate functions rather than one
 * with a flag. The copies they replace did not agree — one kept empty strings,
 * one dropped blank entries but returned them with their surrounding whitespace
 * intact, and one trimmed every entry before dropping the blanks. Collapsing
 * them into a single helper would have changed what two of the five callers
 * produce, so the difference is in the name instead.
 *
 * `server/structuredOutput/yamlUtils.ts` has a sixth variant that coerces dates,
 * numbers and nested

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key