varsubst

0.1.0 • Public • Published

varsubst

Simple library to substitute variables into strings

Install

Install with npm:

$ npm install varsubst

Usage

The API is simple

const varsubst = require('varsubst')
 
varsubst('hello $var', { var: 'world' })              // hello world
varsubst('inThe${var}OfText', { var: 'Middle' })      // inTheMiddleOfText
varsubst('using ${var:-default}', {})                 // using default
varsubst('using ${none:-$var} vars', {var: 'nested'}) // using nested vars
varsubst('${USER} is substituting env', process.env)  // <user> is substituting env

Readme

Keywords

none

Package Sidebar

Install

npm i varsubst

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

27.9 kB

Total Files

8

Last publish

Collaborators

  • nicomt