Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View theLine's full-sized avatar

theLine

View GitHub Profile
@theLine
theLine / format.js
Last active December 30, 2015 02:59 — forked from ewjoachim/format.js
/**
* Does the same as a simple form of python "".format
* that will not work for anything else than number or string.
* Array form :
* "I have {} replacements to {}".format("two", "make")
* "I have {} replacements to {}".format(["two", "make"])
* "I have {0} replacements to {1}".format(["two", "make"])
* Dict form :
* "Hello {name} !".format({name: "Bob"});
* "I am {age} years old".format({age: 12});