forked from jasonmoo/t.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
t.min.js
9 lines (9 loc) · 825 Bytes
/
t.min.js
1
2
3
4
5
6
7
8
9
!function(){function n(n){this.t=n}function t(n){return new Option(n).text.replace(/"/g,""")}function e(n,t){for(var e=t.split(".");e.length;){if(!(e[0]in n))return!1
n=n[e.shift()]}return n}function r(n,f){return n.replace(i,function(n,t,i,o,u,c,a,p){var l,s=e(f,o),d=""
if(!s)return"!"==i?r(u,f):a?r(p,f):""
if(!i)return r(c,f)
if("@"==i){n=f._key,t=f._val
for(l in s)s.hasOwnProperty(l)&&(f._key=l,f._val=s[l],d+=r(u,f))
return f._key=n,f._val=t,d}}).replace(o,function(n,r,i){var o=e(f,i)
return o||0===o?"%"==r?t(o):o:""})}var i=/\{\{(([@!]?)(.+?))\}\}(([\s\S]+?)(\{\{:\1\}\}([\s\S]+?))?)\{\{\/\1\}\}/g,o=/\{\{([=%])(.+?)\}\}/g
n.prototype.render=function(n){return r(this.t,n)},"function"==typeof define&&define.amd?define([],function(){return n}):"object"==typeof exports?module.exports=n:window.t=window.t||n}()