node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »

format-string

format-string

Format a string, using values from an object.

Installation

npm install format-string

Usage

  var formatString = require('format-string');
 
  var user = {
    name: 'Stoeffel',
    modified: new Date()
  };
  formatString('Hello, :name (:modified)', user); // => Hello, Stoeffel (31.12.2014) 

CLI

  $ format-string 'Hello, :name (:modified)' --name stoeffel --modified `date +"%m.%d.%y"`