Comparing version 1.4.2 to 1.5.0
@@ -27,3 +27,2 @@ #!/usr/bin/env node | ||
var template = razorleaf.compile(content, { | ||
debug: true, | ||
include: function(name) { | ||
@@ -30,0 +29,0 @@ return fs.readFileSync(path.join(directory, name + ".leaf"), "utf8"); |
@@ -144,3 +144,3 @@ "use strict"; | ||
function compile(tree, options) { | ||
function compile(tree) { | ||
var context = { | ||
@@ -156,14 +156,10 @@ content: new utilities.CodeContext(), | ||
var code = | ||
var compiled = new Function( | ||
"__util, data", | ||
context.scope.code + | ||
"\n__output = '';\n" + | ||
context.content.code + | ||
"\nreturn __output;"; | ||
"\nreturn __output;" | ||
); | ||
if(options.debug) { | ||
console.log(code); | ||
} | ||
var compiled = new Function("__util, data", code); | ||
return function(data) { | ||
@@ -215,7 +211,9 @@ return compiled(utilities, data); | ||
node.else = { | ||
type: "if", | ||
condition: node.elif[0].condition, | ||
children: node.elif[0].children, | ||
elif: node.elif.slice(1), | ||
else: node.else | ||
children: [{ | ||
type: "if", | ||
condition: node.elif[0].condition, | ||
children: node.elif[0].children, | ||
elif: node.elif.slice(1), | ||
else: node.else | ||
}] | ||
}; | ||
@@ -222,0 +220,0 @@ } |
{ | ||
"name": "razorleaf", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"main": "razorleaf.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -79,7 +79,6 @@ "use strict"; | ||
options = options || {}; | ||
tree = loadExtends(tree, [], options); | ||
loadIncludes(tree, [], options); | ||
return compiler.compile(tree, options); | ||
return compiler.compile(tree); | ||
} | ||
@@ -86,0 +85,0 @@ |
@@ -150,3 +150,4 @@ [![Build Status](https://travis-ci.org/campersander/razorleaf.png)](https://travis-ci.org/campersander/razorleaf) | ||
- **`if (condition)`**: Includes its content only if *`condition`* is met. | ||
- **`else`**: Can immediately follow an `if`. | ||
- **`elif (condition)`**: Can immediately follow an `if` or an `elif`. | ||
- **`else`**: Can immediately follow an `if` or an `elif`. | ||
- **`for (identifier) in (collection)`**: Includes its content for each element | ||
@@ -153,0 +154,0 @@ in the array or array-like object *`collection`*. |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
182
30871
965