shellsubstitute
Like shell substitution but for your JS.
Last updated 4 years ago by refractalize .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install shellsubstitute 
SYNC missed versions from official npm registry.

Shell Substitute npm version npm Build Status

Like shell substitution but for your JS.

var substitute = require('shellsubstitute');

substitute('Hi $USER', {USER: 'Josh'}) // Hi Josh
substitute('Hi ${USER}', {USER: 'Josh'}) // Hi Josh

// escape
substitute('Hi \\$USER', {USER: 'Josh'}) // Hi $USER
substitute('Hi \\${USER}', {USER: 'Josh'}) // Hi ${USER}

// escape escapes
substitute('Hi \\\\$USER', {USER: 'Josh'}) // Hi \$USER
substitute('Hi \\\\${USER}', {USER: 'Josh'}) // Hi \${USER}

Syntax

Variables are $ followed by _ or numbers 0-9 or upper or lower-case characters a-z.

Variables can be wrapped in braces {...}. Useful to delimit the variable from following text.

Current Tags

  • 1.2.0                                ...           latest (4 years ago)

3 Versions

  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 2
This Week 432
This Month 2,308
Last Day 143
Last Week 628
Last Month 2,390
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |