This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.template = function (scopeEval) { | |
// Andrea Giammarchi - WTFPL License | |
var | |
re = /\$\{([\S\s]*?)\}/g, | |
evaluate = [], | |
i = 0, | |
m | |
; | |
while (m = re.exec(this)) { | |
evaluate.push( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var match = [] | |
var _finalizeExpr = function(match) { | |
var vs = match[0] | |
var _iter = match[1] | |
var _done = match[2] | |
var i = 0 | |
var _iterWrappper = function() { | |
if(i === vs.length) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* No regexp. indexOf only */ | |
window._queryToJSON = function(query) | |
{ | |
if(query == null || query.length < 2) | |
return {}; | |
var p = 0; | |
if(query.charAt(p) == '?') | |
++p; |