maximally minimal string formatting library
npm install simple-fmt+. The code isjavascript
var fmt = require("simple-fmt");
console.log(fmt("hello {0} of age {1}", name, age));
`instead of
`javascript
console.log("hello " + name + " of age " + age);
`because string formatting with
+ makes your eyes bleed and fingers hurt.
There's also
fmt.obj(string, obj) and fmt.repeat(string, n):
`javascript
var o = {name: "xyz", age: 42};
fmt.obj("hello {name} of age {age}", obj);
fmt.repeat("", 3); // "**"
`That's it.
Installation
$3
Install using npm npm install simple-fmt
`javascript
var fmt = require("simple-fmt");
`$3
Clone the repo and include it in a script tag git clone https://github.com/olov/simple-fmt.git
`html
``