0.3.0 • Published 9 years ago
peachfuzz v0.3.0
peachfuzz
Simple Mustache inspired string substitution.
API
peachfuzz(template: string, context: Object, transform: Function): string
Usage
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:
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'