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

ampersand-dom-bindings

Package Overview
Dependencies
Maintainers
5
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-dom-bindings - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

LICENSE

77

ampersand-dom-bindings.js

@@ -6,31 +6,2 @@ /*$AMPERSAND_VERSION*/

var partial = require('lodash.partial');
// returns a key-tree-store of functions
// that can be applied to any element/model.
// all resulting functions should be called
// like func(el, value, lastKeyName)
module.exports = function (bindings, context) {
var store = new Store();
var key, current;
for (key in bindings) {
current = bindings[key];
if (typeof current === 'string') {
store.add(key, getBindingFunc({
type: 'text',
selector: current
}));
} else if (current.forEach) {
current.forEach(function (binding) {
store.add(key, getBindingFunc(binding, context));
});
} else {
store.add(key, getBindingFunc(current, context));
}
}
return store;
};
var slice = Array.prototype.slice;

@@ -78,14 +49,16 @@

function getSelector(binding) {
if (typeof binding.selector === 'string') {
return binding.selector;
} else if (binding.hook) {
return '[data-hook~="' + binding.hook + '"]';
} else {
return '';
}
}
function getBindingFunc(binding, context) {
var type = binding.type || 'text';
var isCustomBinding = typeof type === 'function';
var selector = (function () {
if (typeof binding.selector === 'string') {
return binding.selector;
} else if (binding.hook) {
return '[data-hook~="' + binding.hook + '"]';
} else {
return '';
}
})();
var selector = getSelector(binding);
var yes = binding.yes;

@@ -260,1 +233,29 @@ var no = binding.no;

}
// returns a key-tree-store of functions
// that can be applied to any element/model.
// all resulting functions should be called
// like func(el, value, lastKeyName)
module.exports = function (bindings, context) {
var store = new Store();
var key, current;
for (key in bindings) {
current = bindings[key];
if (typeof current === 'string') {
store.add(key, getBindingFunc({
type: 'text',
selector: current
}));
} else if (current.forEach) {
current.forEach(function (binding) {
store.add(key, getBindingFunc(binding, context));
});
} else {
store.add(key, getBindingFunc(current, context));
}
}
return store;
};
{
"name": "ampersand-dom-bindings",
"description": "Takes binding declarations and returns key-tree-store of functions that can be used to apply those bindings.",
"version": "3.6.0",
"version": "3.7.0",
"author": "'Henrik Joreteg' <henrik@andyet.net>",

@@ -6,0 +6,0 @@ "browserify": {

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