Skip to content

Reference

This section documents the complete public surface of @samline/formatter. Start with the API for method signatures, then use the focused references for configuration, regex, types, entrypoints, and the browser global.

  • Configuration — every FormatOptions field, with defaults and per-formatType behavior.
  • API — function-by-function signatures, exported types, advanced helpers, and a side-effects-per-function lookup table.
  • Regex — bundled validation patterns paired with ready-to-use error messages, with the parametric variants.
  • TypeScript — every exported type — FormatType, FormatterResult, FormatOptions, RegexKey, RegexEntry, Regex, the parametric signatures.
  • Entrypoints — ESM / CJS / browser module / /vanilla alias distribution matrix.
  • Browser — the window.Formatter IIFE for no-bundler setups (Shopify, WordPress, classic templates).
  • Recipes — task-oriented recipes for common real-world scenarios.

For presentation and interaction concerns, see Styling and UX. Formatter returns strings and intentionally leaves CSS, validation state, and caret management to the caller.