# @xen-orchestra/template

Latest version **0.1.1** (published 2026-04-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install @xen-orchestra/template
pnpm add @xen-orchestra/template
yarn add @xen-orchestra/template
bun add @xen-orchestra/template
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2026-04-24 |
| First published | 2019-09-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 1 |
| Unpacked size | 2.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 988 |
| Author | Vates SAS |
| Maintainers | mpiton, mlssfrncjrg, mathieura, florent.beauchamp, julien-f, marsaud, pdonias, benjireis, tgoettelmann, b-nollet, joris-k, elise-f, olivier.f, pierre.brunet289 |

## Links

- npm: https://www.npmjs.com/package/@xen-orchestra/template
- Repository: https://github.com/vatesfr/xen-orchestra
- Homepage: https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/template
- Issues: https://github.com/vatesfr/xen-orchestra/issues
- npm.io page: https://npm.io/package/@xen-orchestra/template

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.18.0

## Recent versions

- 0.1.1 (latest) — 2026-04-24
- 0.1.0 — 2019-09-20

## README

<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->

# @xen-orchestra/template

[![Package Version](https://badgen.net/npm/v/@xen-orchestra/template)](https://npmjs.org/package/@xen-orchestra/template) ![License](https://badgen.net/npm/license/@xen-orchestra/template) [![PackagePhobia](https://badgen.net/bundlephobia/minzip/@xen-orchestra/template)](https://bundlephobia.com/result?p=@xen-orchestra/template) [![Node compatibility](https://badgen.net/npm/node/@xen-orchestra/template)](https://npmjs.org/package/@xen-orchestra/template)

## Install

Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/template):

```sh
npm install --save @xen-orchestra/template
```

## Usage

Create a string replacer based on a pattern and a list of rules.

```js
const myReplacer = compileTemplate('{name}_COPY_{name}_{id}_%%', {
  '{name}': vm => vm.name_label,
  '{id}': vm => vm.id,
  '%': (_, i) => i,
})

const newString = myReplacer(
  {
    name_label: 'foo',
    id: 42,
  },
  32
)

newString === 'foo_COPY_{name}_42_32%' // true
```

## Contributions

Contributions are _very_ welcomed, either on the documentation or on
the code.

You may:

- report any [issue](https://github.com/vatesfr/xen-orchestra/issues)
  you've encountered;
- fork and create a pull request.

## License

[ISC](https://spdx.org/licenses/ISC) © [Vates SAS](https://vates.fr)

---
_Source: https://npm.io/package/@xen-orchestra/template · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
