Socket
Socket
Sign inDemoInstall

ampersand-dom-bindings

Package Overview
Dependencies
18
Maintainers
5
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.5.0 to 3.6.0

28

ampersand-dom-bindings.js

@@ -5,4 +5,4 @@ /*$AMPERSAND_VERSION*/

var matchesSelector = require('matches-selector');
var partial = require('lodash.partial');
// returns a key-tree-store of functions

@@ -36,3 +36,2 @@ // that can be applied to any element/model.

var slice = Array.prototype.slice;

@@ -63,2 +62,19 @@

function switchHandler(binding, el, value) {
// the element selector to show
var showValue = binding.cases[value];
// hide all the other elements with a different value
for (var item in binding.cases) {
var curValue = binding.cases[item];
if (value !== item && curValue !== showValue) {
getMatches(el, curValue).forEach(function (match) {
dom.hide(match);
});
}
}
getMatches(el, showValue).forEach(function (match) {
dom.show(match);
});
}
function getBindingFunc(binding, context) {

@@ -202,9 +218,3 @@ var type = binding.type || 'text';

if (!binding.cases) throw Error('switch bindings must have "cases"');
return function (el, value) {
for (var item in binding.cases) {
getMatches(el, binding.cases[item]).forEach(function (match) {
dom[value === item ? 'show' : 'hide'](match);
});
}
};
return partial(switchHandler, binding);
} else if (type === 'innerHTML') {

@@ -211,0 +221,0 @@ return function (el, value) {

{
"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.5.0",
"version": "3.6.0",
"author": "'Henrik Joreteg' <henrik@andyet.net>",

@@ -11,5 +11,6 @@ "browserify": {

},
"bugs": {
"url": "https://github.com/ampersandjs/ampersand-dom-bindings/issues"
},
"repository": "ampersandjs/ampersand-dom-bindings",
"files": [
"ampersand-dom-bindings.js"
],
"dependencies": {

@@ -20,15 +21,15 @@ "ampersand-dom": "^1.2.5",

"key-tree-store": "^1.2.0",
"lodash.partial": "^3.1.1",
"matches-selector": "^1.0.0"
},
"devDependencies": {
"browserify": "^5.11.0",
"browserify": "^11.0.0",
"jshint": "^2.5.6",
"phantomjs": "^1.9.7-15",
"precommit-hook": "^1.0.7",
"run-browser": "~1.3.1",
"tap-spec": "^0.2.0",
"tape": "^2.13.2",
"tape-run": "~0.1.1"
"precommit-hook": "^3.0.0",
"run-browser": "^2.0.2",
"tap-spec": "^4.0.2",
"tape": "^4.0.0",
"tape-run": "^1.0.0"
},
"homepage": "https://github.com/ampersandjs/ampersand-dom-bindings",
"keywords": [

@@ -41,9 +42,11 @@ "dom",

"main": "ampersand-dom-bindings.js",
"repository": {
"type": "git",
"url": "git://github.com/ampersandjs/ampersand-dom-bindings"
},
"scripts": {
"start": "run-browser test/index.js",
"test": "browserify test/index.js | tape-run | tap-spec"
"test": "browserify test/index.js | tape-run | tap-spec",
"lint": "jshint .",
"preversion": "git checkout master && git pull && npm ls",
"publish-patch": "npm run preversion && npm version patch && git push origin master --tags && npm publish",
"publish-minor": "npm run preversion && npm version minor && git push origin master --tags && npm publish",
"publish-major": "npm run preversion && npm version major && git push origin master --tags && npm publish",
"validate": "npm ls"
},

@@ -65,3 +68,7 @@ "testling": {

]
}
},
"pre-commit": [
"lint",
"test"
]
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc