New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

substituter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

substituter

Simple substitution for Node.js

latest
Source
npmnpm
Version
1.3.0
Version published
Weekly downloads
293
-18.84%
Maintainers
1
Weekly downloads
 
Created
Source

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}!' } }

Keywords

substitution

FAQs

Package last updated on 06 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts