substituter

1.3.0 • Public • Published

substituter

Travis Build Coverage Status JavaScript Style Guide substituter

Simple substitution for Node.js

Installation

Install via npm as follows:

$ npm install substituter --save

Usage

Substitute any object property into a template string.

var sub = require('substituter'),
    fs = require('fs');
 
var results = sub('Hello ${globe.region}!', { globe: { region: 'world' } });
// Hello world!
 
results = sub(fs.readFileSync('template.xml'), { val1: 'foo' });
// Does substitution in a Buffer.  results is a string.

Substitute any object property into another object.

var sub = require('substituter');
 
var results = sub({ board: { message: 'Hello ${globe.region}!' }}, { globe: { region: 'world' } });
// { board: { message: 'Hello ${globe.region}!' } }

/substituter/

    Package Sidebar

    Install

    npm i substituter

    Weekly Downloads

    207

    Version

    1.3.0

    License

    Apache-2.0

    Unpacked Size

    14.5 kB

    Total Files

    4

    Last publish

    Collaborators

    • andyday