Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

razorleaf

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

razorleaf - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

1

cli.js

@@ -27,2 +27,3 @@ #!/usr/bin/env node

var template = razorleaf.compile(content, {
debug: true,
include: function(name) {

@@ -29,0 +30,0 @@ return fs.readFileSync(path.join(directory, name + ".leaf"), "utf8");

@@ -161,4 +161,2 @@ "use strict";

var compiled = new Function("__util, data", code);
if(options.debug) {

@@ -168,2 +166,4 @@ console.log(code);

var compiled = new Function("__util, data", code);
return function(data) {

@@ -213,2 +213,12 @@ return compiled(utilities, data);

if(node.elif.length > 0) {
node.else = {
type: "if",
condition: node.elif[0].condition,
children: node.elif[0].children,
elif: node.elif.slice(1),
else: node.else
};
}
return {

@@ -252,3 +262,3 @@ attributes: new utilities.CodeContext(),

if(this.content.parts.length !== 0) {
if(this.content.parts.length !== 0 || node.else) {
this.parent.content.addCode("if(" + conditionName + ") {\n");

@@ -255,0 +265,0 @@ this.parent.content.addContext(this.content);

2

package.json
{
"name": "razorleaf",
"version": "1.4.1",
"version": "1.4.2",
"main": "razorleaf.js",

@@ -5,0 +5,0 @@ "files": [

@@ -334,2 +334,3 @@ "use strict";

this.context.condition = "";
this.context.elif = [];

@@ -355,2 +356,34 @@ delete this.context.name;

specialBlocks.elif = {
begin: function() {
this.context.parent.children.pop();
this.context.type = "elif";
this.context.condition = "";
delete this.context.name;
var previous = this.context.parent.children[this.context.parent.children.length - 1];
if(!previous || previous.type !== "if" || previous.else) {
throw this.error("Unexpected elif");
}
previous.elif.push(this.context);
},
initialState: function whitespace(c) {
if(c !== " ") {
return this.pass(specialBlocks.elif.condition);
}
return whitespace;
},
condition: function condition(c) {
if(c === "\n") {
return this.pass(states.content);
}
this.context.condition += c;
return condition;
}
};
specialBlocks.else = {

@@ -360,3 +393,3 @@ begin: function() {

var previous = this.context.parent.children[this.context.parent.children.length - 2];
var previous = this.context.parent.children[this.context.parent.children.length - 1];

@@ -363,0 +396,0 @@ if(!previous || previous.type !== "if" || previous.else) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc