The `tmpl` package, version 1.0.5, is a minimalist JavaScript micro-templating utility last updated in 2013. Its primary function is basic string interpolation, replacing `{}` placeholders in a template string with corresponding values from a provided data object. This library offers a very limited feature set compared to more robust templating engines like Handlebars or EJS, lacking control flow, iteration, or helper functions. Developed before the widespread availability of native JavaScript template literals (ES6 backticks), `tmpl` is now largely superseded by built-in language features for new development. The project is considered abandoned, with no active maintenance, security updates, or new releases since its last version over a decade ago. While still accumulating significant weekly downloads, this is primarily due to its presence as a transitive dependency in older projects. It functions exclusively within CommonJS environments and offers no native support for ECMAScript Modules (ESM) or TypeScript.
npm install tmplVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic string interpolation using a template string and a data object, showing how placeholders are replaced or retained if data is missing.
It is strongly recommended to migrate away from `tmpl`. Replace its usage with native JavaScript template literals (`` `string ${variable}` ``) or a well-maintained, modern templating library. Conduct a dependency audit to identify if `tmpl` is a direct or transitive dependency and plan for its removal.For direct usage in CommonJS, use `const tmpl = require('tmpl');`. In ESM projects, either use a bundler that can transpile CommonJS to ESM, or ideally, replace `tmpl` with native template literals.You will need to create a custom declaration file (e.g., `tmpl.d.ts`) to provide types. For example: `declare module 'tmpl' { function tmpl(template: string, data?: object): string; export = tmpl; }`.For new code, always prefer native template literals. For existing code, refactor to use template literals wherever possible.
Ensure your project is configured for CommonJS or use a bundler that can handle CommonJS modules within an ESM context. For new code, prefer native ES module `import` statements and template literals.
`tmpl` exports a single function as its default. Ensure you are importing it correctly as a default CommonJS export and calling it directly: `const result = tmpl('...', data);`.No dependency data recorded yet.