A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
// Ported from apps/web/src/features/letters/length.ts. Pure, so Node can check it.
/** Most recruiters read 180 to 320 words; the bar runs to 450. */
export const LETTER_LENGTH = { min: 180, max: 320, scale: 450 } as const;
export type LetterLength = "empty" | "short" | "comfortable" | "long";
// ponytail: counts whitespace-separated words, so text without spaces (Chinese, Japanese) counts low.
export function countWords(html: string): number {
const text = html
.replace(/<[^>]*>/g, " ")
.replace(/ | /g, " ")
.trim();
return text ? text.split(/\s+/).length : 0;
}
export function letterLength(words: number): LetterLength {
if (words === 0) return "empty";
if (words < LETTER_LENGTH.min) return "short";
return words <= LETTER_LENGTH.max ? "comfortable" : "long";
}