Kiwi is a light-weight JavaScript module for string interpolation.
Find a file
2013-02-15 14:58:37 -05:00
lib/jasmine-1.2.0 Init. 2013-02-15 12:32:07 -05:00
spec Added the logic to handle when array is null. 2013-02-15 14:58:37 -05:00
src Added the logic to handle when array is null. 2013-02-15 14:58:37 -05:00
MIT-LICENSE.txt Added the license file. 2013-02-15 12:35:44 -05:00
README.md Update README.md 2013-02-15 14:35:08 -05:00
SpecRunner_kiwi.html Init. 2013-02-15 12:32:07 -05:00

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%.