You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

shellsubstitute

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shellsubstitute

Like shell substitution but for your JS.

1.2.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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.

Keywords

shell

FAQs

Package last updated on 18 Oct 2016

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