a swab is remotely like a mustache except it isn't

npm install swab
4 downloads in the last week
16 downloads in the last month

Build Status


a swab is sort of like a mustache except it isn't. swab can't escape things or anything. a brush is a bit more like a mustache.

swab is pretty tiny:

$ wc -c < swab.min.js

swab works everywhere:

if(typeof module!=='undefined') module.exports=swab;
else if(typeof window!=='undefined') window.swab=swab;
return swab;


var swab = require('swab');
var template = 'banana is {{banana}} and I see a bunch of {{ninjas}}';
var context = { banana: 'tasty' }; //ninjas are obviously invisible
console.log(swab(template, context));


banana is tasty and I see a bunch of 
npm loves you