https://github.com/devinus/peachfuzz
Simple Mustache inspired string substitution microlibrary
https://github.com/devinus/peachfuzz
Last synced: 7 months ago
JSON representation
Simple Mustache inspired string substitution microlibrary
- Host: GitHub
- URL: https://github.com/devinus/peachfuzz
- Owner: devinus
- License: cc0-1.0
- Created: 2015-04-03T02:21:51.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-03T16:08:07.000Z (about 11 years ago)
- Last Synced: 2025-02-12T03:48:09.460Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 148 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# peachfuzz
[](https://travis-ci.org/devinus/peachfuzz)
[](https://coveralls.io/r/devinus/peachfuzz)

Simple Mustache inspired string substitution.
## API
```ts
peachfuzz(template: string, context: Object, transform: Function): string
```
## Usage
```js
var peachfuzz = require('peachfuzz');
peachfuzz('Hello {{name}}', { name: 'Devin' }); //=> 'Hello Devin'
```
`peachfuzz` takes an optional `transform` argument that allows values pulled
from the context to be transformed before substitution:
```js
var peachfuzz = require('peachfuzz');
var template = 'https://swag.shop/?product={{product}}';
var context = { product: 'Moustache Wax' };
peachfuzz(template, context, encodeURIComponent);
//=> 'https://swag.shop/?product=Moustache%20Wax'
```