2.0.0 • Published 8 years ago
vrep v2.0.0
vrep
Replaces variables in a string.
Installation
For using it as a library:
npm install --save vrepFor using it from the command line:
npm install -g vrepPlease note: you might need to use sudo on some systems for global install.
Library Usage Examples
var format = require("vrep").format;
var text1 = format("Hi, my name is {name} and I'm {age}.", {name: "Marc", age: "23"});
var text2 = format("Hi, my name is {1} and I'm {2}.", ["Marc", "23"]);Use your own variable style and encode the values before insertion:
var format = require("vrep").create("[$", "]", encodeURIComponent);
var text1 = format("Hi, my name is [$name] and I'm [$age].", {name: "Marc", age: "23"});
var text2 = format("Hi, my name is [$1] and I'm [$2].", ["Marc", "23"]);Command Line Usage Example
For echoing the result:
vrep template.txt data.jsonFor writing the result to file:
vrep template.txt data.json result.txt2.0.0
8 years ago
1.1.0
9 years ago
1.0.1-final.1512181002
10 years ago
1.0.0-final.1512151612
10 years ago