Answer-formatter is a minimal utility (v0.1.8, no regular release schedule) for formatting answer text, primarily targeting Node.js (>=16.17.0) and browser environments. It provides a simple function to transform answer strings with consistent spacing, punctuation, and optional suffixes. Unlike full-featured formatting libraries (e.g., date-fns, numeral), it focuses narrowly on answer text normalization. The package is small, has zero dependencies, and ships as a single CommonJS file.
npm install answer-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: formatting a trimmed, capitalized, and punctuated answer string.
Pass a copy if original is needed: formatAnswer(String(str))
Upgrade Node to 16.17.0 or later, or use a transpiler.
Use const { formatAnswer } = require('answer-formatter');Use dynamic import: const { formatAnswer } = await import('answer-formatter'); or switch to CJS.No dependency data recorded yet.