Added precondition checks to validate input files and paths to return more informative error messages as per #2
Simple string formatting using {}.
{}
assert.equal( tmpl('the answer is {answer}', { answer: 42 }), 'the answer is 42')