mirego/foreigner.js — pull request #4 by charlesdemers (2014-11-26 19:44:31+00:00)
Title: Refactor internal methods and add tests

Please don’t mind files in the `dist` folder when reviewing, these are built.

Results:
- Follow Mirego’s coding guidelines
- Kind of self-document tokenizer regular expressions by building them with named variables
- Improve performance (tested with very non-scientific benchmarks)

API changes:
- We are now less strict about whitespace inside expressions
- Edge-case clarification:
- When a translation has variables, passing a non-object to `t` will simply output the string
- When a translation has variables, passing an empty object to `t` will replace variables with an empty string