Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

eval('b=...'), jsDocs

  • Loading branch information...
commit d9b956d31c421be86ed3bec07f141a822e601337 1 parent 2d61312
@indutny authored
Showing with 14 additions and 5 deletions.
  1. +14 −5 jsTPL.js
View
19 jsTPL.js
@@ -7,18 +7,28 @@
* Last one is input stack, normally you must pust $_
*/
var jsTPL = (function($,undefined) {
+
/** Escaping closure
* Only global variables will be available here
+ * @param{string} a Code to evaluate
+ * @param{string} b Variable to store output
* @return {Function}
*/
- function $eval(a) {
- return eval(a)[0];
+ function $eval(a,b) {
+ return eval(a);
}
(function ($tab , gid ,
cache , namecache , $brackets , $modificator ,
$tabs , $spaces , $decorator , modificators, rtrim) {
-
+
+ /**
+ * Map elements of array using call function
+ * Supports Array.map function
+ * @param{array} arr Source array
+ * @param{Function} call Process function
+ * @return{array}
+ */
function map(arr, call) {
if (arr.map)
return arr.map(call);
@@ -196,8 +206,7 @@ var jsTPL = (function($,undefined) {
// Create function with overdriven args
// In secure closure
- // Fixed: IE was throwing error I is undefined, so returned to array evaluation
- i = $eval("[function($scope,$args,$p," + args.join(",") + "){$_=[];" + compiled + ";return $_.join('')}]");
+ i = $eval("b=function($scope,$args,$p," + args.join(",") + "){$_=[];" + compiled + ";return $_.join('')}");
/**
* Generate arguments array that will be passed to template function
Please sign in to comment.
Something went wrong with that request. Please try again.