# swap

> Horribly simple templating

Latest version **0.0.3** (published 2013-05-02) · 0 weekly downloads

## Install

```sh
npm install swap
pnpm add swap
yarn add swap
bun add swap
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2013-05-02 |
| First published | 2012-09-05 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | gsf |

## Links

- npm: https://www.npmjs.com/package/swap
- Repository: https://github.com/gsf/swap.js
- Homepage: https://github.com/gsf/swap.js.git
- npm.io page: https://npm.io/package/swap

## Recent versions

- 0.0.3 (latest) — 2013-05-02
- 0.0.2 — 2012-09-05
- 0.0.1 — 2012-09-05

## README

# swap.js

Horribly simple templating.

[![Build Status](https://travis-ci.org/gsf/swap.js.png?branch=master)](https://travis-ci.org/gsf/swap.js)

## Usage

Swap performs string interpolation. 

```js
var swap = require('swap')

var story = swap('{subject} {action} to the {location}.', {
  subject: 'Elle and Dez',
  action: 'strolled',
  location: 'market'
})

console.log(story) // "Elle and Dez strolled to the market."
```

Comments are contained within exclamation points.

```js
var topSecret = swap('I am here{! with two kittens!}.')

console.log(topSecret) // "I am here."
```

Prepend with a backslash to escape a replacement field.

```js
var demo = swap('This is a field: \{bob}.')

console.log(demo) // "This is a field: {bob}."
```

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