Example of very small module, with tests, travis, npm, etc. npm install endwith --save var endwith = require('endwith') var s = 'This string should end with a period' endwith(s,'.') > 'This string should end with a period.'