Socket
Book a DemoInstallSign in
Socket

@dropb/expand

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dropb/expand

Expand placeholders in a template string/strings

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

expand

Expand placeholders in a template string/strings

npm version Build status

Install

npm install --save @dropb/expand

Usage

const { expand } = require('@dropb/expand');

const values = { one: 'One', two: 'Two', '3': 'Three', '4': 'Four', five: ['Five', 'Six'] };
console.log(expand('{one}...{two}...{3}...{ 4 }...{five[0]}', values));
// One...Two...Three...Four...Five

const { Template } = require('@dropb/expand');
Template.sep = '${ }';

const template = ['-loglevel', '${level}', '-i', '${in}', 'copy', '-f', 'flv', '${out}'];
const config = { level: 'info', in: '/tmp/file.mkv', out: '/tmp/output.mp4' };
console.log(expand(template, config));
/*
[ '-loglevel',
  'info',
  '-i',
  '/tmp/file.mkv',
  'copy',
  '-f',
  'flv',
  '/tmp/output.mp4' ]
*/

License

MIT

Keywords

template

FAQs

Package last updated on 19 Jul 2019

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