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

derby-templates

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

derby-templates - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

.jshintrc

2

index.js

@@ -1,3 +0,1 @@

// createPathExpression is not required here, since it should be an optional
// include on the client
exports.contexts = require('./lib/contexts');

@@ -4,0 +2,0 @@ exports.expressions = require('./lib/expressions');

@@ -17,2 +17,4 @@ exports.ContextMeta = ContextMeta;

this.idCount = 0;
this.pending = [];
this.pauseCount = 0;
}

@@ -153,1 +155,32 @@

};
Context.prototype.pause = function() {
this.meta.pauseCount++;
};
Context.prototype.unpause = function() {
if (--this.meta.pauseCount) return;
this.flush();
};
Context.prototype.flush = function() {
var pending = this.meta.pending;
var len = pending.length;
if (!len) return;
this.meta.pending = [];
for (var i = 0; i < len; i++) {
pending[i].run();
}
};
Context.prototype.queueCreate = function(object) {
this.meta.pending.push(new PendingCreate(object, this));
};
function PendingCreate(object, context) {
this.object = object;
this.context = context;
}
PendingCreate.prototype.run = function() {
this.object.create(this.context);
};

@@ -472,9 +472,9 @@ var serializeObject = require('serialize-object');

NewExpression.prototype.type = 'NewExpression';
NewExpression.prototype._applyFn = function(fn, context) {
NewExpression.prototype._applyFn = function(Fn, context) {
// Apply if there are no path inputs
if (!this.args) return new fn();
if (!this.args) return new Fn();
// Otherwise, get the current value for path inputs and apply
var inputs = this._getInputs(context);
inputs.unshift(null);
return new (fn.bind.apply(fn, inputs))();
return new (Fn.bind.apply(Fn, inputs))();
};

@@ -481,0 +481,0 @@

@@ -38,6 +38,6 @@ // `-` and `+` can be either unary or binary, so all unary operators are

, '==': function(left, right) {
return left == right;
return left == right; // jshint ignore:line
}
, '!=': function(left, right) {
return left != right;
return left != right; // jshint ignore:line
}

@@ -44,0 +44,0 @@ , '===': function(left, right) {

@@ -25,3 +25,3 @@ var saddle = require('saddle');

// Add Template::resolve
saddle.Template.prototype.resolve = function() {}
saddle.Template.prototype.resolve = function() {};

@@ -148,3 +148,3 @@ // The Template::dependencies method is specific to how Derby bindings work,

var fragment = template.getFragment(context, binding);
if (this.componentFactory) this.componentFactory.create(context);
if (this.componentFactory) context.queueCreate(this.componentFactory);
return fragment;

@@ -156,3 +156,3 @@ };

template.appendTo(parent, context);
if (this.componentFactory) this.componentFactory.create(context);
if (this.componentFactory) context.queueCreate(this.componentFactory);
};

@@ -163,3 +163,3 @@ View.prototype.attachTo = function(parent, node, context) {

var node = template.attachTo(parent, node, context);
if (this.componentFactory) this.componentFactory.create(context);
if (this.componentFactory) context.queueCreate(this.componentFactory);
return node;

@@ -240,3 +240,3 @@ };

var namespace = contextView && contextView.namespace;
var view = context.meta.views.find(name, namespace);
var view = name && context.meta.views.find(name, namespace);
if (!view) {

@@ -293,14 +293,19 @@ if (this.optional) return exports.emptyTemplate;

var segments = name.split(':');
var segmentsDepth = segments.length;
if (namespace) segments = namespace.split(':').concat(segments);
// Iterate through segments, leaving the last segment and removing the
// second to last segment to traverse up the namespaces
while (segments.length > 1) {
segments.splice(-2, 1);
var testName = segments.join(':');
var match = map[testName];
if (match) return match;
// Iterate through segments, leaving the `segmentsDepth` segments and
// removing the second to `segmentsDepth` segment to traverse up the
// namespaces. Decrease `segmentsDepth` if not found and repeat again.
while (segmentsDepth > 0) {
while (segments.length > segmentsDepth) {
segments.splice(-1 - segmentsDepth, 1);
var testName = segments.join(':');
var match = map[testName];
if (match) return match;
}
segmentsDepth--;
}
};
Views.prototype.register = function(name, source, options) {
mapName = name.replace(/:index$/, '');
var mapName = name.replace(/:index$/, '');
var view = this.nameMap[mapName];

@@ -307,0 +312,0 @@ if (view) {

{
"name": "derby-templates",
"version": "0.1.1",
"version": "0.1.2",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha --recursive test --bail --colors --reporter spec --debug"
"test": "./node_modules/.bin/mocha && ./node_modules/.bin/jshint lib/*.js test/*.js"
},

@@ -12,8 +12,10 @@ "author": "",

"dependencies": {
"saddle": "~0.2.0",
"saddle": "~0.3.0",
"serialize-object": "~0.0.5"
},
"devDependencies": {
"expect.js": "~0.2.0"
"expect.js": "~0.3.1",
"jshint": "~2.4.4",
"mocha": "~1.17.1"
}
}
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