JSPM

shellsubstitute

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19476
  • Score
    100M100P100Q135743F
  • License ISC

Package Exports

  • shellsubstitute

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (shellsubstitute) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.