Posted By

chupzzz on 12/26/11


js template light

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Simple JS templater

 / Published in: JavaScript


Using: t("Hello {who}!", { who: "JavaScript" }); t("Hello {who}! It's {time} ms since epoch.", { who: "JavaScript", time: });

  1. function t(s,d){
  2. for(var p in d)
  3. s=s.replace(new RegExp('{'+p+'}','g'), d[p]);
  4. return s;
  5. }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: on November 23, 2018

the 8 best shower mate water resistant wireless bluetooth portable speaker

Posted By: on January 7, 2019

download best software to android root use app kingo or 360 for pc mac ios windows 10 8 1 7 xp computer zcore

You need to login to post a comment.