Posted By

chupzzz on 12/26/11


Tagged

js template light


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

slashyy77


Simple JS templater


 / Published in: JavaScript
 

URL: http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-javascript-templating-engine/

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

  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  

Comments

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

the 8 best shower mate water resistant wireless bluetooth portable speaker http://topportablespeaker.com/top/the-8-best-shower-mate-water-resistant-wireless-bluetooth-portable-speaker-3160

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.