Kaffeine

Extended Javascript for Pros

Fork me on GitHub

String Extensions

multiline strings

Allows for multiline strings:

list = "1. Eggs
2. SOY SAUCE
3. Milk
"

It maintains newlines, but this can be suppressed with the \ character (which conveniently provides parity with normal javascript)

html = "1. Eggs \
2. SOY SAUCE \
3. Milk "

String Interpolation

This module provides ruby style string interpolation via #{} within double quoted strings

name = "#{first} #{second}"
age = "#{this_year - birth_year}"

This following example uses both multiline and string interpolation at once

letter = "Dear #{name},
I am writing to you to inform you of #{purpose}
Kind Regards
#{sender}
"

To surpress the interpolation use \#, or single quoted strings:

a = "\#{hello}"
b = '#{hello}'