# expand-template

> Expand placeholders in a template string

Latest version **2.0.3** (published 2018-11-27) · (MIT OR WTFPL) license · 0 weekly downloads

## Install

```sh
npm install expand-template
pnpm add expand-template
yarn add expand-template
bun add expand-template
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2018-11-27 |
| First published | 2015-08-10 |
| Weekly downloads | 0 |
| License | (MIT OR WTFPL) |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | LM |
| Maintainers | ralphtheninja |
| Keywords | template, expand, replace |

## Links

- npm: https://www.npmjs.com/package/expand-template
- Repository: https://github.com/ralphtheninja/expand-template
- Issues: https://github.com/ralphtheninja/expand-template/issues
- npm.io page: https://npm.io/package/expand-template

## Recent versions

- 2.0.3 (latest) — 2018-11-27
- 2.0.2 — 2018-11-27
- 2.0.1 — 2018-11-20
- 2.0.0 — 2018-06-21
- 1.1.1 — 2018-05-07
- 1.1.0 — 2017-08-22
- 1.0.4 — 2017-08-22
- 1.0.3 — 2016-09-14
- 1.0.2 — 2015-11-12
- 1.0.1 — 2015-10-28
- 1.0.0 — 2015-08-10

## README

# expand-template

> Expand placeholders in a template string.

[![npm](https://img.shields.io/npm/v/expand-template.svg)](https://www.npmjs.com/package/expand-template)
![Node version](https://img.shields.io/node/v/expand-template.svg)
[![Build Status](https://travis-ci.org/ralphtheninja/expand-template.svg?branch=master)](https://travis-ci.org/ralphtheninja/expand-template)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```
$ npm i expand-template -S
```

## Usage

Default functionality expands templates using `{}` as separators for string placeholders.

```js
var expand = require('expand-template')()
var template = '{foo}/{foo}/{bar}/{bar}'
console.log(expand(template, {
  foo: 'BAR',
  bar: 'FOO'
}))
// -> BAR/BAR/FOO/FOO
```

Custom separators:

```js
var expand = require('expand-template')({ sep: '[]' })
var template = '[foo]/[foo]/[bar]/[bar]'
console.log(expand(template, {
  foo: 'BAR',
  bar: 'FOO'
}))
// -> BAR/BAR/FOO/FOO
```

## License
All code, unless stated otherwise, is dual-licensed under [`WTFPL`](http://www.wtfpl.net/txt/copying/) and [`MIT`](https://opensource.org/licenses/MIT).

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