Comparing version 4.0.2 to 4.0.3
@@ -24,10 +24,13 @@ function _mergeNamespaces(n, m) { | ||
var nativeToString = Object.prototype.toString; | ||
var nativeHasOwnProperty = Object.prototype.hasOwnProperty; | ||
const nativeToString = Object.prototype.toString; | ||
const nativeHasOwnProperty = Object.prototype.hasOwnProperty; | ||
function isUndefined(obj) { | ||
return obj === undefined; | ||
} | ||
function isArray(obj) { | ||
return nativeToString.call(obj) === '[object Array]'; | ||
} | ||
/** | ||
@@ -41,6 +44,7 @@ * Return true, if target owns a property with the given key. | ||
*/ | ||
function has(target, key) { | ||
return nativeHasOwnProperty.call(target, key); | ||
} | ||
/** | ||
@@ -55,6 +59,7 @@ * Iterate over collection; returning something | ||
*/ | ||
function forEach(collection, iterator) { | ||
var val, result; | ||
let val, | ||
result; | ||
if (isUndefined(collection)) { | ||
@@ -64,7 +69,9 @@ return; | ||
var convertKey = isArray(collection) ? toNum : identity; | ||
const convertKey = isArray(collection) ? toNum : identity; | ||
for (var key in collection) { | ||
for (let key in collection) { | ||
if (has(collection, key)) { | ||
val = collection[key]; | ||
result = iterator(val, convertKey(key)); | ||
@@ -79,2 +86,3 @@ | ||
function identity(arg) { | ||
@@ -81,0 +89,0 @@ return arg; |
@@ -28,10 +28,13 @@ 'use strict'; | ||
var nativeToString = Object.prototype.toString; | ||
var nativeHasOwnProperty = Object.prototype.hasOwnProperty; | ||
const nativeToString = Object.prototype.toString; | ||
const nativeHasOwnProperty = Object.prototype.hasOwnProperty; | ||
function isUndefined(obj) { | ||
return obj === undefined; | ||
} | ||
function isArray(obj) { | ||
return nativeToString.call(obj) === '[object Array]'; | ||
} | ||
/** | ||
@@ -45,6 +48,7 @@ * Return true, if target owns a property with the given key. | ||
*/ | ||
function has(target, key) { | ||
return nativeHasOwnProperty.call(target, key); | ||
} | ||
/** | ||
@@ -59,6 +63,7 @@ * Iterate over collection; returning something | ||
*/ | ||
function forEach(collection, iterator) { | ||
var val, result; | ||
let val, | ||
result; | ||
if (isUndefined(collection)) { | ||
@@ -68,7 +73,9 @@ return; | ||
var convertKey = isArray(collection) ? toNum : identity; | ||
const convertKey = isArray(collection) ? toNum : identity; | ||
for (var key in collection) { | ||
for (let key in collection) { | ||
if (has(collection, key)) { | ||
val = collection[key]; | ||
result = iterator(val, convertKey(key)); | ||
@@ -83,2 +90,3 @@ | ||
function identity(arg) { | ||
@@ -85,0 +93,0 @@ return arg; |
@@ -30,10 +30,13 @@ (function (global, factory) { | ||
var nativeToString = Object.prototype.toString; | ||
var nativeHasOwnProperty = Object.prototype.hasOwnProperty; | ||
const nativeToString = Object.prototype.toString; | ||
const nativeHasOwnProperty = Object.prototype.hasOwnProperty; | ||
function isUndefined(obj) { | ||
return obj === undefined; | ||
} | ||
function isArray(obj) { | ||
return nativeToString.call(obj) === '[object Array]'; | ||
} | ||
/** | ||
@@ -47,6 +50,7 @@ * Return true, if target owns a property with the given key. | ||
*/ | ||
function has(target, key) { | ||
return nativeHasOwnProperty.call(target, key); | ||
} | ||
/** | ||
@@ -61,6 +65,7 @@ * Iterate over collection; returning something | ||
*/ | ||
function forEach(collection, iterator) { | ||
var val, result; | ||
let val, | ||
result; | ||
if (isUndefined(collection)) { | ||
@@ -70,7 +75,9 @@ return; | ||
var convertKey = isArray(collection) ? toNum : identity; | ||
const convertKey = isArray(collection) ? toNum : identity; | ||
for (var key in collection) { | ||
for (let key in collection) { | ||
if (has(collection, key)) { | ||
val = collection[key]; | ||
result = iterator(val, convertKey(key)); | ||
@@ -85,2 +92,3 @@ | ||
function identity(arg) { | ||
@@ -87,0 +95,0 @@ return arg; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MinDom={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;function o(e,t){return r.call(e,t)}function i(e,t){var r;if(void 0!==e){var i=function(e){return"[object Array]"===n.call(e)}(e)?u:l;for(var c in e)if(o(e,c)&&!1===t(r=e[c],i(c)))return r}}function l(e){return e}function u(e){return Number(e)}const c=Object.prototype.toString;function a(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function d(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function s(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(d(r,t))return r;r=r.parentNode}return d(r,t)?r:null}a.prototype.add=function(e){return this.list.add(e),this},a.prototype.remove=function(e){return"[object RegExp]"==c.call(e)?this.removeMatching(e):(this.list.remove(e),this)},a.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},a.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},a.prototype.array=function(){return Array.from(this.list)},a.prototype.has=a.prototype.contains=function(e){return this.list.contains(e)};var f={},p=window.addEventListener?"addEventListener":"attachEvent",h=window.removeEventListener?"removeEventListener":"detachEvent",y="addEventListener"!==p?"on":"",v=t({__proto__:null,bind:f.bind=function(e,t,n,r){return e[p](y+t,n,r||!1),n},unbind:f.unbind=function(e,t,n,r){return e[h](y+t,n,r||!1),n},default:f},[f]),g=["focus","blur"];var b,m={bind:function(e,t,n,r,o){return-1!==g.indexOf(n)&&(o=!0),v.bind(e,n,(function(n){var o=n.target||n.srcElement;n.delegateTarget=s(o,t,!0),n.delegateTarget&&r.call(e,n)}),o)},unbind:function(e,t,n,r){return-1!==g.indexOf(t)&&(r=!0),v.unbind(e,t,n,r)}},E=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=n[1];if("body"==r){return(o=t.createElement("html")).innerHTML=e,o.removeChild(o.lastChild)}var o,i=Object.prototype.hasOwnProperty.call(w,r)?w[r]:w._default,l=i[0],u=i[1],c=i[2];(o=t.createElement("div")).innerHTML=u+e+c;for(;l--;)o=o.lastChild;if(o.firstChild==o.lastChild)return o.removeChild(o.firstChild);var a=t.createDocumentFragment();for(;o.firstChild;)a.appendChild(o.removeChild(o.firstChild));return a},O=!1;"undefined"!=typeof document&&((b=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',O=!b.getElementsByTagName("link").length,b=void 0);var w={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:O?[1,"X<div>","</div>"]:[0,"",""]};w.td=w.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],w.option=w.optgroup=[1,'<select multiple="multiple">',"</select>"],w.thead=w.tbody=w.colgroup=w.caption=w.tfoot=[1,"<table>","</table>"],w.polyline=w.ellipse=w.polygon=w.circle=w.text=w.line=w.path=w.rect=w.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var T=E;e.assignStyle=function(e,...t){const n=e.style;return i(t,(function(e){e&&i(e,(function(e,t){n[t]=e}))})),e},e.attr=function(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)},e.classes=function(e){return new a(e)},e.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},e.closest=s,e.delegate=m,e.domify=T,e.event=v,e.matches=d,e.query=function(e,t){return(t=t||document).querySelector(e)},e.queryAll=function(e,t){return(t=t||document).querySelectorAll(e)},e.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MinDom={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;function o(e,t){return r.call(e,t)}function i(e,t){let r,i;if(void 0===e)return;const c=function(e){return"[object Array]"===n.call(e)}(e)?u:l;for(let n in e)if(o(e,n)&&(r=e[n],i=t(r,c(n)),!1===i))return r}function l(e){return e}function u(e){return Number(e)}const c=Object.prototype.toString;function d(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function a(e,t){return e&&"function"==typeof e.matches&&e.matches(t)}function s(e,t,n){for(var r=n?e:e.parentNode;r&&r.nodeType!==document.DOCUMENT_NODE&&r.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(a(r,t))return r;r=r.parentNode}return a(r,t)?r:null}d.prototype.add=function(e){return this.list.add(e),this},d.prototype.remove=function(e){return"[object RegExp]"==c.call(e)?this.removeMatching(e):(this.list.remove(e),this)},d.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},d.prototype.toggle=function(e,t){return void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},d.prototype.array=function(){return Array.from(this.list)},d.prototype.has=d.prototype.contains=function(e){return this.list.contains(e)};var f={},p=window.addEventListener?"addEventListener":"attachEvent",h=window.removeEventListener?"removeEventListener":"detachEvent",y="addEventListener"!==p?"on":"",g=t({__proto__:null,bind:f.bind=function(e,t,n,r){return e[p](y+t,n,r||!1),n},unbind:f.unbind=function(e,t,n,r){return e[h](y+t,n,r||!1),n},default:f},[f]),b=["focus","blur"];var v,m={bind:function(e,t,n,r,o){return-1!==b.indexOf(n)&&(o=!0),g.bind(e,n,(function(n){var o=n.target||n.srcElement;n.delegateTarget=s(o,t,!0),n.delegateTarget&&r.call(e,n)}),o)},unbind:function(e,t,n,r){return-1!==b.indexOf(t)&&(r=!0),g.unbind(e,t,n,r)}},E=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var r=n[1];if("body"==r){return(o=t.createElement("html")).innerHTML=e,o.removeChild(o.lastChild)}var o,i=Object.prototype.hasOwnProperty.call(w,r)?w[r]:w._default,l=i[0],u=i[1],c=i[2];(o=t.createElement("div")).innerHTML=u+e+c;for(;l--;)o=o.lastChild;if(o.firstChild==o.lastChild)return o.removeChild(o.firstChild);var d=t.createDocumentFragment();for(;o.firstChild;)d.appendChild(o.removeChild(o.firstChild));return d},O=!1;"undefined"!=typeof document&&((v=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',O=!v.getElementsByTagName("link").length,v=void 0);var w={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:O?[1,"X<div>","</div>"]:[0,"",""]};w.td=w.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],w.option=w.optgroup=[1,'<select multiple="multiple">',"</select>"],w.thead=w.tbody=w.colgroup=w.caption=w.tfoot=[1,"<table>","</table>"],w.polyline=w.ellipse=w.polygon=w.circle=w.text=w.line=w.path=w.rect=w.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var T=E;e.assignStyle=function(e,...t){const n=e.style;return i(t,(function(e){e&&i(e,(function(e,t){n[t]=e}))})),e},e.attr=function(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)},e.classes=function(e){return new d(e)},e.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},e.closest=s,e.delegate=m,e.domify=T,e.event=g,e.matches=a,e.query=function(e,t){return(t=t||document).querySelector(e)},e.queryAll=function(e,t){return(t=t||document).querySelectorAll(e)},e.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "min-dom", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "A minimal dom utility toolbelt", | ||
@@ -38,3 +38,3 @@ "main": "dist/index.js", | ||
"domify": "^1.4.1", | ||
"min-dash": "^3.8.1" | ||
"min-dash": "^4.0.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1484
118026
+ Addedmin-dash@4.2.1(transitive)
- Removedmin-dash@3.8.1(transitive)
Updatedmin-dash@^4.0.0