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

mithril

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mithril - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

mithril.js

4

mithril.min.js
/*
Mithril v0.1.3
Mithril v0.1.4
http://github.com/lhorie/mithril.js

@@ -7,3 +7,3 @@ (c) Leo Horie

*/
!new function(a){function b(e,f,g){if(null===f||void 0===f)return void(g&&d(g.nodes));if("retain"!==f.subtree){var h=s.call(g),i=s.call(f);if(h!=i&&(null!==g&&void 0!==g&&d(g.nodes),g=new f.constructor,g.nodes=[]),"[object Array]"==i){for(var j=[],k=g.length===f.length,l=0;l<f.length;l++){var m=b(e,f[l],g[l]);void 0!==m&&(m.nodes.intact||(k=!1),g[l]=m)}if(!k){for(var l=0;l<f.length;l++)void 0!==g[l]&&(j=j.concat(g[l].nodes));for(var n,l=j.length;n=g.nodes[l];l++)null!==n.parentNode&&n.parentNode.removeChild(n);for(var n,l=g.nodes.length;n=j[l];l++)null===n.parentNode&&e.appendChild(n);g.length=f.length,g.nodes=j}}else if("[object Object]"==i){if((f.tag!=g.tag||Object.keys(f.attrs).join()!=Object.keys(g.attrs).join())&&d(g.nodes),"string"!=typeof f.tag)return;var n,o=0===g.nodes.length;o?(n=a.document.createElement(f.tag),g={tag:f.tag,attrs:c(n,f.attrs,{}),children:b(n,f.children,g.children),nodes:[n]},e.appendChild(n)):(n=g.nodes[0],c(n,f.attrs,g.attrs),g.children=b(n,f.children,g.children),g.nodes.intact=!0,n.parentNode!==e&&e.appendChild(n)),"[object Function]"==s.call(f.attrs.config)&&f.attrs.config(n,!o)}else{var n;if(0===g.nodes.length){if(f.$trusted){var p=e.lastChild;e.insertAdjacentHTML("beforeend",f),n=p?p.nextSibling:e.firstChild}else n=a.document.createTextNode(f),e.appendChild(n);g="string number boolean".indexOf(typeof f)>-1?new f.constructor(f):f,g.nodes=[n]}else if(g.valueOf()!==f.valueOf()){if(f.$trusted){var q=g.nodes[0],j=[q];if(q){for(;q=q.nextSibling;)j.push(q);d(j);var p=e.lastChild;e.insertAdjacentHTML("beforeend",f),n=p?p.nextSibling:e.firstChild}else e.innerHTML=f}else n=g.nodes[0],e.appendChild(n),n.nodeValue=f;g=new f.constructor(f),g.nodes=[n]}else g.nodes.intact=!0}return g}}function c(b,c,d){for(var e in c){var g=c[e],h=d[e];if(!(e in d)||h!==g||b===a.document.activeElement){if("config"===e)continue;if("function"==typeof g&&0==e.indexOf("on"))String(g)!==String(h)&&(b[e]=f(g,b));else if("style"===e)for(var i in g)(void 0===h||h[i]!==g[i])&&(b.style[i]=g[i]);else e in b?b[e]=g:b.setAttribute(e,g);d[e]=g}}return d}function d(a){for(var b=0;b<a.length;b++)a[b].parentNode.removeChild(a[b]);a.length=0}function e(a){var b={};for(var c in a)b[c]=a[c];return b}function f(a,b){return function(c){m.startComputation();var d=a.call(b,c);return m.endComputation(),d}}function g(){if(C=a.performance&&a.performance.now?a.performance.now():(new a.Date).getTime(),C-D>16)m.redraw();else{var b=a.cancelAnimationFrame||a.clearTimeout,c=a.requestAnimationFrame||a.setTimeout;b(E),E=c(m.redraw,0)}}function h(a,b,c){J={};for(var d in b){if(d==c)return!void m.module(a,b[d]);var e=new RegExp("^"+d.replace(/:[^\/]+/g,"([^\\/]+)")+"$");if(e.test(c))return!void c.replace(e,function(){for(var c=d.match(/:[^\/]+/g),e=[].slice.call(arguments,1,-2),f=0;f<c.length;f++)J[c[f].slice(1)]=e[f];m.module(a,b[d])})}}function i(a){a.preventDefault(),m.route(a.currentTarget.getAttribute("href"))}function j(){"hash"!=m.route.mode&&a.location.hash&&(a.location.hash=a.location.hash)}function k(a){return a}function l(b){var c=a.XDomainRequest?new a.XDomainRequest:new a.XMLHttpRequest;return c.open(b.method,b.url,!0,b.user,b.password),c.onload="function"==typeof b.onload?b.onload:function(){},c.onerror="function"==typeof b.onerror?b.onerror:function(){},"function"==typeof b.config&&b.config(c,b),c.send(b.data),c}function n(a,b){var c=[];for(var d in a){var e=b?b+"["+d+"]":d,f=a[d];c.push("object"==typeof f?n(f,e):encodeURIComponent(e)+"="+encodeURIComponent(f))}return c.join("&")}function o(a,b,c){return b&&Object.keys(b).length>0&&("GET"==a.method?a.url=a.url+(a.url.indexOf("?")<0?"?":"&")+n(b):a.data=c(b)),a}function p(a,b){var c=a.match(/:\w+/g);if(c&&b)for(var d=0;d<c.length;d++){var e=c[d].slice(1);a=a.replace(c[d],b[e]),delete b[e]}return a}function q(a){var b=a.then;return function(a,c){var d=b(function(b){return d(a(b))},function(a){return d(c(a))});return d.then=q(d),d}}var r={},s={}.toString,t=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,u=/\[(.+?)(?:=("|'|)(.+?)\2)?\]/;Mithril=m=function(){var a=arguments,b="[object Object]"==s.call(a[1]),c=b?a[1]:{},d="class"in c?"class":"className",f=r[a[0]];if(void 0===f){r[a[0]]=f={tag:"div",attrs:{}};for(var g,h=[];g=t.exec(a[0]);)if(""==g[1])f.tag=g[2];else if("#"==g[1])f.attrs.id=g[2];else if("."==g[1])h.push(g[2]);else if("["==g[3][0]){var i=u.exec(g[3]);f.attrs[i[1]]=i[3]||!0}h.length>0&&(f.attrs[d]=h.join(" "))}f=e(f),f.attrs=e(f.attrs),f.children=b?a[2]:a[1];for(var j in c)f.attrs[j]=j==d?(f.attrs[j]||"")+" "+c[j]:c[j];return f};var v,w={insertAdjacentHTML:function(b,c){a.document.write(c),a.document.close()},appendChild:function(b){void 0===v&&(v=a.document.createElement("html")),"HTML"==b.nodeName?v=b:v.appendChild(b),a.document.documentElement!==v&&a.document.replaceChild(v,a.document.documentElement)}},x=[],y={};m.render=function(c,d){var e=x.indexOf(c),f=0>e?x.push(c)-1:e,g=c==a.document||c==a.document.documentElement?w:c;y[f]=b(g,d,y[f])},m.trust=function(a){return a=new String(a),a.$trusted=!0,a};var z,A={view:function(){}},B={},C=0,D=0,E=0;m.module=function(a,b){m.startComputation(),z=a,A=b,B=new b.controller,m.endComputation()},m.redraw=function(){m.render(z,A.view(B)),D=C};var F=0,G=null;m.startComputation=function(){F++},m.endComputation=function(){F=Math.max(F-1,0),0==F&&(g(),G&&(G(),G=null))},m.withAttr=function(a,b){return function(c){b(a in c.currentTarget?c.currentTarget[a]:c.currentTarget.getAttribute(a))}};var H={pathname:"",hash:"#",search:"?"},I=function(){},J={};m.route=function(){if(3==arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2];I=function(a){var e=a.slice(H[m.route.mode].length);h(b,d,e)||m.route(c,!0)};var e="hash"==m.route.mode?"onhashchange":"onpopstate";a[e]=function(){I(a.location[m.route.mode])},G=j,a[e]()}else if(arguments[0].addEventListener){var f=arguments[0],g=arguments[1];g||(f.removeEventListener("click",i),f.addEventListener("click",i))}else if("string"==typeof arguments[0]){var k=arguments[0],l=arguments[1]===!0;a.history.pushState?(G=function(){a.history[l?"replaceState":"pushState"](null,a.document.title,H[m.route.mode]+k),j()},I(H[m.route.mode]+k)):a.location[m.route.mode]=k}},m.route.param=function(a){return J[a]},m.route.mode="search",m.prop=function(a){return function(){return arguments.length&&(a=arguments[0]),a}},m.deferred=function(){var a=[],b=[],c={resolve:function(b){for(var c=0;c<a.length;c++)a[c](b)},reject:function(a){for(var c=0;c<b.length;c++)b[c](a)},promise:m.prop()};return c.promise.resolvers=a,c.promise.then=function(c,d){function e(a,b,c){a.push(function(a){try{var e=c(a);e&&"function"==typeof e.then?e.then(f[b],d):f[b](void 0!==e?e:a)}catch(g){if(g instanceof Error&&g.constructor!==Error)throw g;f.reject(g)}})}var f=m.deferred();return c||(c=k),d||(d=k),e(a,"resolve",c),e(b,"reject",d),f.promise},c},m.sync=function(a){function b(b){return function(f){return e.push(f),b||(c="reject"),e.length==a.length&&(d.promise(e),d[c](e)),f}}for(var c="resolve",d=m.deferred(),e=[],f=0;f<a.length;f++)a[f].then(b(!0),b(!1));return d.promise},m.request=function(a){m.startComputation();var b=m.deferred(),c=a.serialize||JSON.stringify,d=a.deserialize||JSON.parse;return a.url=p(a.url,a.data),a=o(a,a.data,c),a.onload=a.onerror=function(c){var e=("load"==c.type?a.unwrapSuccess:a.unwrapError)||k,f=e(d(c.target.responseText));if(f instanceof Array&&a.type)for(var g=0;g<f.length;g++)f[g]=new a.type(f[g]);else a.type&&(f=new a.type(f));b.promise(f),b["load"==c.type?"resolve":"reject"](f),m.endComputation()},l(a),b.promise.then=q(b.promise),b.promise},"undefined"!=typeof module&&null!==module&&(module.exports=m),"function"==typeof define&&define.amd&&define(function(){return m}),m.deps=function(b){return a=b}}(this);
!new function(a){function b(e,f,g,h,i,j){if(null===f||void 0===f)return void(g&&d(g.nodes));if("retain"!==f.subtree){var k=s.call(g),l=s.call(f);if(k!=l&&(null!==g&&void 0!==g&&d(g.nodes),g=new f.constructor,g.nodes=[]),"[object Array]"==l){for(var m=[],n=g.length===f.length,o=0;o<f.length;o++){var p=b(e,f[o],g[o],h,o,j);void 0!==p&&(p.nodes.intact||(n=!1),g[o]=p)}if(!n){for(var o=0;o<f.length;o++)void 0!==g[o]&&(m=m.concat(g[o].nodes));for(var q,o=m.length;q=g.nodes[o];o++)null!==q.parentNode&&q.parentNode.removeChild(q);for(var q,o=g.nodes.length;q=m[o];o++)null===q.parentNode&&e.appendChild(q);g.length=f.length,g.nodes=m}}else if("[object Object]"==l){if((f.tag!=g.tag||Object.keys(f.attrs).join()!=Object.keys(g.attrs).join())&&d(g.nodes),"string"!=typeof f.tag)return;var q,r=0===g.nodes.length;"svg"===f.tag&&(j="http://www.w3.org/2000/svg"),r?(q=void 0===j?a.document.createElement(f.tag):a.document.createElementNS(j,f.tag),g={tag:f.tag,attrs:c(q,f.attrs,{},j),children:b(q,f.children,g.children,!0,void 0,j),nodes:[q]},e.insertBefore(q,e.childNodes[i])):(q=g.nodes[0],c(q,f.attrs,g.attrs,j),g.children=b(q,f.children,g.children,!1,void 0,j),g.nodes.intact=!0,h===!0&&e.insertBefore(q,e.childNodes[i])),"[object Function]"==s.call(f.attrs.config)&&f.attrs.config(q,!r)}else{var q;if(0===g.nodes.length){if(f.$trusted){var t=e.lastChild;e.insertAdjacentHTML("beforeend",f),q=t?t.nextSibling:e.firstChild}else q=a.document.createTextNode(f),e.insertBefore(q,e.childNodes[i]);g="string number boolean".indexOf(typeof f)>-1?new f.constructor(f):f,g.nodes=[q]}else if(g.valueOf()!==f.valueOf()){if(f.$trusted){var u=g.nodes[0],m=[u];if(u){for(;u=u.nextSibling;)m.push(u);d(m);var t=e.lastChild;e.insertAdjacentHTML("beforeend",f),q=t?t.nextSibling:e.firstChild}else e.innerHTML=f}else q=g.nodes[0],e.insertBefore(q,e.childNodes[i]),q.nodeValue=f;g=new f.constructor(f),g.nodes=[q]}else g.nodes.intact=!0}return g}}function c(b,c,d,e){for(var g in c){var h=c[g],i=d[g];if(!(g in d)||i!==h||b===a.document.activeElement){if(d[g]=h,"config"===g)continue;if("function"==typeof h&&0==g.indexOf("on"))b[g]=f(h,b);else if("style"===g)for(var j in h)(void 0===i||i[j]!==h[j])&&(b.style[j]=h[j]);else void 0!==e?"href"===g?b.setAttributeNS("http://www.w3.org/1999/xlink","href",h):"className"===g?b.setAttribute("class",h):b.setAttribute(g,h):g in b?b[g]=h:b.setAttribute(g,h)}}return d}function d(a){for(var b=0;b<a.length;b++)a[b].parentNode.removeChild(a[b]);a.length=0}function e(a){var b={};for(var c in a)b[c]=a[c];return b}function f(a,b){return function(c){m.startComputation();var d=a.call(b,c);return m.endComputation(),d}}function g(){if(C=a.performance&&a.performance.now?a.performance.now():(new a.Date).getTime(),C-D>16)m.redraw();else{var b=a.cancelAnimationFrame||a.clearTimeout,c=a.requestAnimationFrame||a.setTimeout;b(E),E=c(m.redraw,0)}}function h(a,b,c){J={};for(var d in b){if(d==c)return!void m.module(a,b[d]);var e=new RegExp("^"+d.replace(/:[^\/]+/g,"([^\\/]+)")+"$");if(e.test(c))return!void c.replace(e,function(){for(var c=d.match(/:[^\/]+/g),e=[].slice.call(arguments,1,-2),f=0;f<c.length;f++)J[c[f].slice(1)]=e[f];m.module(a,b[d])})}}function i(a){a.preventDefault(),m.route(a.currentTarget.getAttribute("href"))}function j(){"hash"!=m.route.mode&&a.location.hash&&(a.location.hash=a.location.hash)}function k(a){return a}function l(b){var c=a.XDomainRequest?new a.XDomainRequest:new a.XMLHttpRequest;return c.open(b.method,b.url,!0,b.user,b.password),c.onload="function"==typeof b.onload?b.onload:function(){},c.onerror="function"==typeof b.onerror?b.onerror:function(){},"function"==typeof b.config&&b.config(c,b),c.send(b.data),c}function n(a,b){var c=[];for(var d in a){var e=b?b+"["+d+"]":d,f=a[d];c.push("object"==typeof f?n(f,e):encodeURIComponent(e)+"="+encodeURIComponent(f))}return c.join("&")}function o(a,b,c){return b&&Object.keys(b).length>0&&("GET"==a.method?a.url=a.url+(a.url.indexOf("?")<0?"?":"&")+n(b):a.data=c(b)),a}function p(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;d<c.length;d++){var e=c[d].slice(1);a=a.replace(c[d],b[e]),delete b[e]}return a}function q(a){var b=a.then;return function(a,c){var d=b(function(b){return d(a(b))},function(a){return d(c(a))});return d.then=q(d),d}}var r={},s={}.toString,t=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,u=/\[(.+?)(?:=("|'|)(.+?)\2)?\]/;Mithril=m=function(){var a=arguments,b="[object Object]"==s.call(a[1]),c=b?a[1]:{},d="class"in c?"class":"className",f=r[a[0]];if(void 0===f){r[a[0]]=f={tag:"div",attrs:{}};for(var g,h=[];g=t.exec(a[0]);)if(""==g[1])f.tag=g[2];else if("#"==g[1])f.attrs.id=g[2];else if("."==g[1])h.push(g[2]);else if("["==g[3][0]){var i=u.exec(g[3]);f.attrs[i[1]]=i[3]||!0}h.length>0&&(f.attrs[d]=h.join(" "))}f=e(f),f.attrs=e(f.attrs),f.children=b?a[2]:a[1];for(var j in c)f.attrs[j]=j==d?(f.attrs[j]||"")+" "+c[j]:c[j];return f};var v,w={insertAdjacentHTML:function(b,c){a.document.write(c),a.document.close()},appendChild:function(b){void 0===v&&(v=a.document.createElement("html")),"HTML"==b.nodeName?v=b:v.appendChild(b),a.document.documentElement!==v&&a.document.replaceChild(v,a.document.documentElement)}},x=[],y={};m.render=function(c,d){var e=x.indexOf(c),f=0>e?x.push(c)-1:e,g=c==a.document||c==a.document.documentElement?w:c;y[f]=b(g,d,y[f],!1)},m.trust=function(a){return a=new String(a),a.$trusted=!0,a};var z,A={view:function(){}},B={},C=0,D=0,E=0;m.module=function(a,b){m.startComputation(),z=a,A=b,B=new b.controller,m.endComputation()},m.redraw=function(){m.render(z,A.view(B)),D=C};var F=0,G=null;m.startComputation=function(){F++},m.endComputation=function(){F=Math.max(F-1,0),0==F&&(g(),G&&(G(),G=null))},m.withAttr=function(a,b){return function(c){b(a in c.currentTarget?c.currentTarget[a]:c.currentTarget.getAttribute(a))}};var H={pathname:"",hash:"#",search:"?"},I=function(){},J={};m.route=function(){if(3==arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2];I=function(a){var e=a.slice(H[m.route.mode].length);h(b,d,e)||m.route(c,!0)};var e="hash"==m.route.mode?"onhashchange":"onpopstate";a[e]=function(){I(a.location[m.route.mode])},G=j,a[e]()}else if(arguments[0].addEventListener){var f=arguments[0],g=arguments[1];g||(f.removeEventListener("click",i),f.addEventListener("click",i))}else if("string"==typeof arguments[0]){var k=arguments[0],l=arguments[1]===!0;a.history.pushState?(G=function(){a.history[l?"replaceState":"pushState"](null,a.document.title,H[m.route.mode]+k),j()},I(H[m.route.mode]+k)):a.location[m.route.mode]=k}},m.route.param=function(a){return J[a]},m.route.mode="search",m.prop=function(a){return function(){return arguments.length&&(a=arguments[0]),a}},m.deferred=function(){var a=[],b=[],c={resolve:function(b){for(var c=0;c<a.length;c++)a[c](b)},reject:function(a){for(var c=0;c<b.length;c++)b[c](a)},promise:m.prop()};return c.promise.resolvers=a,c.promise.then=function(c,d){function e(a,b,c){a.push(function(a){try{var e=c(a);e&&"function"==typeof e.then?e.then(f[b],d):f[b](void 0!==e?e:a)}catch(g){if(g instanceof Error&&g.constructor!==Error)throw g;f.reject(g)}})}var f=m.deferred();return c||(c=k),d||(d=k),e(a,"resolve",c),e(b,"reject",d),f.promise},c},m.sync=function(a){function b(b){return function(f){return e.push(f),b||(c="reject"),e.length==a.length&&(d.promise(e),d[c](e)),f}}for(var c="resolve",d=m.deferred(),e=[],f=0;f<a.length;f++)a[f].then(b(!0),b(!1));return d.promise},m.request=function(a){m.startComputation();var b=m.deferred(),c=a.serialize||JSON.stringify,d=a.deserialize||JSON.parse;return a.url=p(a.url,a.data),a=o(a,a.data,c),a.onload=a.onerror=function(c){var e=("load"==c.type?a.unwrapSuccess:a.unwrapError)||k,f=e(d(c.target.responseText));if(f instanceof Array&&a.type)for(var g=0;g<f.length;g++)f[g]=new a.type(f[g]);else a.type&&(f=new a.type(f));b.promise(f),b["load"==c.type?"resolve":"reject"](f),m.endComputation()},l(a),b.promise.then=q(b.promise),b.promise},"undefined"!=typeof module&&null!==module&&(module.exports=m),"function"==typeof define&&define.amd&&define(function(){return m}),m.deps=function(b){return a=b}}(this);
//# sourceMappingURL=mithril.min.map

@@ -5,3 +5,3 @@ {

"keywords": ["mvc", "framework"],
"version": "0.1.3",
"version": "0.1.4",
"author": "Leo Horie <leohorie@hotmail.com>",

@@ -11,3 +11,3 @@ "repository": {"type": "git", "url": "https://github.com/lhorie/mithril"},

"licenses": [{"type": "MIT", "url": "http://opensource.org/licenses/MIT"}],
"files": ["mithril.min.js", "mithril.min.map"]
"files": ["mithril.min.js", "mithril.min.map", "mithril.js"]
}

Sorry, the diff of this file is not supported yet

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