# repstr

> Replace in a template string all values provided in an object

Latest version **1.1.0** (published 2017-05-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-05-05 |
| First published | 2016-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Josemi Juanes |
| Maintainers | jmjuanes |
| Keywords | replace, string, object, template, string-template |

## Links

- npm: https://www.npmjs.com/package/repstr
- Repository: https://github.com/jmjuanes/repstr
- Homepage: https://github.com/jmjuanes/repstr#readme
- Issues: https://github.com/jmjuanes/repstr/issues
- npm.io page: https://npm.io/package/repstr

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-05-05
- 1.0.0 — 2016-05-07

## README

# RepStr

[![npm](https://img.shields.io/npm/v/repstr.svg?style=flat-square)](https://www.npmjs.com/package/repstr)
[![npm](https://img.shields.io/npm/dt/repstr.svg?style=flat-square)](https://www.npmjs.com/package/repstr)

Replace in a template string all values provided in an object

## Installation

Use [NPM](https://www.npmjs.com/package/repstr) to install **RepStr**:

```
npm install repstr
```

## Usage

```javascript
//Import dependencies 
var rep_str = require('repstr');

//Compile the template string
var str = rep_str('My car is {color}', { color: 'blue'});

//Display in console
console.log(str); //-> My car is blue
```

## API

### rep_str(str, obj [, prefix][, suffix])

Return a new string. Accepts the following arguments:

- `str`: template string.
- `obj`: an object with all the keys to be replaced in your template string. 
- `prefix` **(optionally)**: a string with the prefix of the template variable. Default value is `{`.
- `suffix` **(optionally)**: a string with the suffix of the template variable. Default value is `}`.

## License

Under the [MIT LICENSE](LICENSE).

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