kiwi/README.md
Ziang Song b8ddab02aa Update README.md
Typo.
2013-02-15 14:35:08 -05:00

652 B

Kiwi

Kiwi is a javascript module which can do string interpolation.

Example

  • API
Kiwi.compose(<input_string>, <array of the strings to interpolate>);
  • Use % (percentage symbol) as the place holder.

var input = "The quick brown % jumps over the lazy %.";
var result = Kiwi.compose(input, ["fox", "dog"]);
console.log(result);

//Output: The quick brown fox jumps over the lazy dog.

  • Use ` (Grave accent symbol) to escape the % symbol.

var input = "The % is 50`%.";
var result = Kiwi.compose(input, ["chance"]);
console.log(result);

//Output: The chance is 50%.