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

xjst

Package Overview
Dependencies
Maintainers
2
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xjst - npm Package Compare versions

Comparing version 0.2.11 to 0.2.12

6

lib/xjst/compiler.js

@@ -158,5 +158,7 @@ var xjst = require('../xjst'),

fns[o.id] = { body: res.join(''), alt: o.longId };
if (o.fn) {
fns[o.id] = { body: res.join(''), alt: o.longId };
res = ['return ', fnName(o), '.call(this);'];
res = ['return ', fnName(o), '.call(this);'];
}

@@ -163,0 +165,0 @@ // Compile statement or wrap it into a function

@@ -13,9 +13,9 @@ var xjst = require('../../xjst'),

if (target['switch']) {
target.cases.forEach(function(branch) {
liftState(source, branch[1]);
});
if (!target['switch']) return;
target.cases.forEach(function(branch) {
liftState(source, branch[1]);
});
liftState(source, target['default']);
}
if (target.propagated) return;
liftState(source, target['default']);
}

@@ -79,3 +79,3 @@

fn: true,
state: xjst.state.create()
state: xjst.state.create({ values: values })
},

@@ -86,3 +86,3 @@ id = 0;

function group(templates, state) {
if (!state) state = xjst.state.create();
if (!state) state = xjst.state.create({ values: values });

@@ -194,3 +194,11 @@ // If we can't create groups - return error statement

id: ++id,
state: xjst.state.create(state, tagStr, -result.id),
state: xjst.state.create(
state,
tagStr,
[null].concat(values[tag[0]].map(function(value) {
return utils.stringify(value);
}).filter(function(value) {
return !subgroup[value];
}))
),
stmt: errStmt

@@ -197,0 +205,0 @@ };

@@ -6,7 +6,8 @@ var xjst = require('../xjst'),

//
// ### function State ()
// #### @parent {State} Setup inheritance
// ### function State (parent, options)
// #### @parent {State} (optional) Setup inheritance
// #### @options {Object} (optional) State configuration
// Node's state manager constructor
//
function State(parent) {
function State(parent, options) {
// We'll hold mutliple possible states

@@ -16,5 +17,7 @@ if (parent) {

this.mutual = parent.mutual;
this.options = parent.options;
} else {
this.states = { high: {}, low: {} };
this.mutual = false;
this.options = options || {};
}

@@ -24,11 +27,21 @@ }

//
// ### function create (parent, key, value)
// ### function create (parent, key, value, options)
// #### @parent {State} (optional) parent state
// #### @key {String|Number} (optional, needs @parent) Property name to change
// #### @value {any} (optional, needs @parent) Value to set
// #### @options {Object} (optional) State configuration
// State's constructor's wrapper
//
exports.create = function create(parent, key, value) {
var state = new State(parent);
// Also possible to call with only `options` argument passed:
// state.create({ ... options ... }) )
//
exports.create = function create(parent, key, value, options) {
// First argument can be options object
if (typeof parent === 'object' && !(parent instanceof State)) {
parent = undefined;
options = parent;
}
var state = new State(parent, options);
if (key) state.set(key, value);

@@ -35,0 +48,0 @@

{
"name": "xjst",
"description": "XSLT inspired JavaScript templates (with spices)",
"version": "0.2.11",
"version": "0.2.12",
"homepage": "http://github.com/veged/xjst",

@@ -6,0 +6,0 @@ "author": "Sergey Berezhnoy <veged@mail.ru> (http://github.com/veged)",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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