bianco.attr
Advanced tools
Comparing version 0.0.2 to 0.0.3
16
index.js
@@ -15,3 +15,3 @@ 'use strict'; | ||
*/ | ||
const normalize = values => values.length === 1 ? values[0] : values | ||
const normalize = values => values.length === 1 ? values[0] : values; | ||
@@ -27,3 +27,3 @@ /** | ||
function parseNodes(els, name, method) { | ||
const names = typeof name === 'string' ? [name] : name | ||
const names = typeof name === 'string' ? [name] : name; | ||
return normalize(domToArray(els).map(el => { | ||
@@ -58,8 +58,8 @@ return normalize(names.map(n => el[method](n))) | ||
function set(els, name, value) { | ||
const attrs = typeof name === 'object' ? name : { [name]: value } | ||
const props = Object.keys(attrs) | ||
const attrs = typeof name === 'object' ? name : { [name]: value }; | ||
const props = Object.keys(attrs); | ||
domToArray(els).forEach(el => { | ||
props.forEach(prop => el.setAttribute(prop, attrs[prop])) | ||
}) | ||
props.forEach(prop => el.setAttribute(prop, attrs[prop])); | ||
}); | ||
return els | ||
@@ -140,3 +140,3 @@ } | ||
has | ||
} | ||
}; | ||
@@ -147,2 +147,2 @@ exports.set = set; | ||
exports.has = has; | ||
exports['default'] = index_next; | ||
exports['default'] = index_next; |
{ | ||
"name": "bianco.attr", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Helper to set/get/remove DOM attributes on a list of nodes", | ||
"main": "index.js", | ||
"jsnext:main": "index.next.js", | ||
"module": "index.next.js", | ||
"scripts": { | ||
"prepublish": "npm run build && npm test", | ||
"prepare": "npm run build && npm test", | ||
"lint": "eslint index.next.js test.js rollup.config.js", | ||
@@ -33,8 +34,8 @@ "build": "rollup -c", | ||
"devDependencies": { | ||
"jsdom": "9.8.0", | ||
"jsdom-global": "2.1.0" | ||
"jsdom": "11.7.0", | ||
"jsdom-global": "3.0.2" | ||
}, | ||
"dependencies": { | ||
"bianco.dom-to-array": "^0.0.4" | ||
"bianco.dom-to-array": "^0.0.8" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16546
253
+ Addedbianco.dom-to-array@0.0.8(transitive)
- Removedbianco.dom-to-array@0.0.4(transitive)
Updatedbianco.dom-to-array@^0.0.8