2.5 KiB
@suaveplan/templates
A plugin-based string template engine for TypeScript. Resolves {variable} and {variable:transform} tokens in strings using a priority-sorted, regex-scan pipeline — no eval, no AST parser overhead. Designed for filling templates in notification messages, email subjects, file name patterns, code generation, and similar string-expansion tasks. Ships nine built-in plugins: dot-notation and array-index variable resolution; case, regex, and split transforms; counter, datetime, and UUID dynamic generators; and conditional/loop control flow. Three preset bundles (minimal, standard, full) let you trade features for bundle size. The injectable Clock and Rng make every rendering call deterministic in tests. Do not confuse with @suaveplan/i18n, which handles locale-keyed message catalogs and plural forms — use this package when your source strings are already in the target language and you only need token substitution.
When to use this skill
- Implementing or debugging code that imports
@suaveplan/templates. - The task touches: see package README.
- You need API guidance for this package's exports.
Quick reference
import { /* see API Reference below */ } from "@suaveplan/templates";
Dependencies
Workspace dependencies: @suaveplan/error, @suaveplan/types
Where to read more
This skill is intentionally short. The package's own documentation is the authoritative source — read these in order:
packages/foundation/templates/README.md— overview, install, quick-start, module indexpackages/foundation/templates/src/**/*.md— co-located docs per implementation file (Purpose, Features, Basic + Advanced examples, full API reference, Implementation notes — all packages ship ≥200 words per module)packages/foundation/templates/package.jsonexportsmap — every subpath you can import from
When the user asks an API question, read the relevant co-located .md first; do not answer from training-data memory.
See also
@suaveplan/error@suaveplan/types
This SKILL.md is auto-generated by suaveplan-skills/scripts/generate-skills.ts from the package's README. Do not edit by hand — re-run the generator after the README changes.