Wondering what‚Äôs next for npm?Check out our public roadmap! ¬Ľ

    @dropb/expand
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0¬†‚Äʬ†Public¬†‚Äʬ†Published

    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

    Install

    npm i @dropb/expand

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    5.75 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar