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

mithril

Package Overview
Dependencies
Maintainers
2
Versions
160
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 1.1.5 to 1.1.6

tests/index.html

13

bundler/minify.js
"use strict"
var http = require("http")
var http = require("https")
var querystring = require("querystring")

@@ -25,3 +25,2 @@ var fs = require("fs")

method: "POST",
protocol: "http:",
hostname: "closure-compiler.appspot.com",

@@ -37,4 +36,12 @@ path: "/compile",

})
res.on("end", function() {
var results = JSON.parse(response)
try {
var results = JSON.parse(response)
} catch(e) {
console.error(response);
throw e;
}
if (results.errors) {

@@ -41,0 +48,0 @@ for (var i = 0; i < results.errors.length; i++) console.log(results.errors[i])

# Change log
- [v1.1.6](#v116)
- [v1.1.5](#v115)

@@ -15,6 +16,33 @@ - [v1.1.4](#v114)

### v1.1.6
#### Bug fixes
- core: render() function can no longer prevent from changing `document.activeElement` in lifecycle hooks ([#1988](https://github.com/MithrilJS/mithril.js/pull/1988), [@purplecode](https://github.com/purplecode))
- core: don't call `onremove` on the children of components that return null from the view [#1921](https://github.com/MithrilJS/mithril.js/issues/1921) [@octavore](https://github.com/octavore) ([#1922](https://github.com/MithrilJS/mithril.js/pull/1922))
- hypertext: correct handling of shared attributes object passed to `m()`. Will copy attributes when it's necessary [#1941](https://github.com/MithrilJS/mithril.js/issues/1941) [@s-ilya](https://github.com/s-ilya) ([#1942](https://github.com/MithrilJS/mithril.js/pull/1942))
#### Ospec improvements
- ospec v1.4.0
- Added support for async functions and promises in tests ([#1928](https://github.com/MithrilJS/mithril.js/pull/1928), [@StephanHoyer](https://github.com/StephanHoyer))
- Error handling for async tests with `done` callbacks supports error as first argument ([#1928](https://github.com/MithrilJS/mithril.js/pull/1928))
- Error messages which include newline characters do not swallow the stack trace [#1495](https://github.com/MithrilJS/mithril.js/issues/1495) ([#1984](https://github.com/MithrilJS/mithril.js/pull/1984), [@RodericDay](https://github.com/RodericDay))
- ospec v2.0.0 (to be released)
- Added support for custom reporters ([#2009](https://github.com/MithrilJS/mithril.js/pull/2020))
- Make Ospec more [Flems](https://flems.io)-friendly ([#2034](https://github.com/MithrilJS/mithril.js/pull/2034))
- Works either as a global or in CommonJS environments
- the o.run() report is always printed asynchronously (it could be synchronous before if none of the tests were async).
- Properly point to the assertion location of async errors [#2036](https://github.com/MithrilJS/mithril.js/issues/2036)
- expose the default reporter as `o.report(results)`
- Don't try to access the stack traces in IE9
---
### v1.1.5
- API: If a user sets the Content-Type header within a request's options, that value will be the entire header value rather than being appended to the default value ([#1924](https://github.com/MithrilJS/mithril.js/pull/1924))
#### Bug fixes
- API: If a user sets the Content-Type header within a request's options, that value will be the entire header value rather than being appended to the default value [#1919](https://github.com/MithrilJS/mithril.js/issues/1919) ([#1924](https://github.com/MithrilJS/mithril.js/pull/1924), [@tskillian](https://github.com/tskillian))
---

@@ -24,4 +52,6 @@

#### Bug fixes:
- Fix IE bug where active element is null causing render function to throw error. ([1943]
#### Bug fixes
- Fix IE bug where active element is null causing render function to throw error ([#1943](https://github.com/MithrilJS/mithril.js/pull/1943), [@JacksonJN](https://github.com/JacksonJN))
---

@@ -31,9 +61,11 @@

#### Bug fixes:
#### Bug fixes
- move out npm dependencies added by mistake
---
### v1.1.2
#### Bug fixes:
#### Bug fixes

@@ -49,3 +81,3 @@ - core: Namespace fixes [#1819](https://github.com/MithrilJS/mithril.js/issues/1819), ([#1825](https://github.com/MithrilJS/mithril.js/pull/1825) [@SamuelTilly](https://github.com/SamuelTilly)), [#1820](https://github.com/MithrilJS/mithril.js/issues/1820) ([#1864](https://github.com/MithrilJS/mithril.js/pull/1864)), [#1872](https://github.com/MithrilJS/mithril.js/issues/1872) ([#1873](https://github.com/MithrilJS/mithril.js/pull/1873))

#### Ospec improvements:
#### Ospec improvements

@@ -55,10 +87,11 @@ - Shell command: Ignore hidden directories and files ([#1855](https://github.com/MithrilJS/mithril.js/pull/1855) [@pdfernhout)](https://github.com/pdfernhout))

#### Docs / Repo maintenance:
#### Docs / Repo maintenance
Our thanks to [@0joshuaolson1](https://github.com/0joshuaolson1), [@ACXgit](https://github.com/ACXgit), [@cavemansspa](https://github.com/cavemansspa), [@CreaturesInUnitards](https://github.com/CreaturesInUnitards), [@dlepaux](https://github.com/dlepaux), [@isaaclyman](https://github.com/isaaclyman), [@kevinkace](https://github.com/kevinkace), [@micellius](https://github.com/micellius), [@spacejack](https://github.com/spacejack) and [@yurivish](https://github.com/yurivish)
#### Other:
#### Other
- Addition of a performance regression test suite ([#1789](https://github.com/MithrilJS/mithril.js/issues/1789))
---

@@ -73,2 +106,4 @@ ### v1.1.1

---
### v1.1.0

@@ -75,0 +110,0 @@

@@ -20,2 +20,6 @@ ;(function() {

var hasOwn = {}.hasOwnProperty
function isEmpty(object) {
for (var key in object) if (hasOwn.call(object, key)) return false
return true
}
function compileSelector(selector) {

@@ -41,2 +45,11 @@ var match, tag = "div", classes = [], attrs = {}

var className = attrs.className || attrs.class
if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
var newAttrs = {}
for(var key in attrs) {
if (hasOwn.call(attrs, key)) {
newAttrs[key] = attrs[key]
}
}
attrs = newAttrs
}
for (var key in state.attrs) {

@@ -810,5 +823,6 @@ if (hasOwn.call(state.attrs, key)) {

if (vnode.attrs && typeof vnode.attrs.onremove === "function") vnode.attrs.onremove.call(vnode.state, vnode)
if (typeof vnode.tag !== "string" && typeof vnode._state.onremove === "function") vnode._state.onremove.call(vnode.state, vnode)
if (vnode.instance != null) onremove(vnode.instance)
else {
if (typeof vnode.tag !== "string") {
if (typeof vnode._state.onremove === "function") vnode._state.onremove.call(vnode.state, vnode)
if (vnode.instance != null) onremove(vnode.instance)
} else {
var children = vnode.children

@@ -974,5 +988,5 @@ if (Array.isArray(children)) {

dom.vnodes = vnodes
for (var i = 0; i < hooks.length; i++) hooks[i]()
// document.activeElement can return null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
if (active != null && $doc.activeElement !== active) active.focus()
for (var i = 0; i < hooks.length; i++) hooks[i]()
}

@@ -1243,3 +1257,3 @@ return {render: render, setEventCallback: setEventCallback}

m.buildQueryString = buildQueryString
m.version = "1.1.5"
m.version = "1.1.6"
m.vnode = Vnode

@@ -1246,0 +1260,0 @@ if (typeof module !== "undefined") module["exports"] = m

@@ -1,44 +0,44 @@

(function(){function B(a,d,e,g,f,p){return{tag:a,key:d,attrs:e,children:g,text:f,dom:p,domSize:void 0,state:void 0,_state:void 0,events:void 0,instance:void 0,skip:!1}}function D(a){var d=arguments[1],e=2;if(null==a||"string"!==typeof a&&"function"!==typeof a&&"function"!==typeof a.view)throw Error("The selector must be either a string or a component.");if("string"===typeof a){var g;if(!(g=M[a])){var f="div";for(var p=[],k={};g=P.exec(a);){var q=g[1],m=g[2];""===q&&""!==m?f=m:"#"===q?k.id=m:"."===
q?p.push(m):"["===g[3][0]&&((q=g[6])&&(q=q.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===g[4]?p.push(q):k[g[4]]=""===q?q:q||!0)}0<p.length&&(k.className=p.join(" "));g=M[a]={tag:f,attrs:k}}}if(null==d)d={};else if("object"!==typeof d||null!=d.tag||Array.isArray(d))d={},e=1;if(arguments.length===e+1)f=arguments[e],Array.isArray(f)||(f=[f]);else for(f=[];e<arguments.length;)f.push(arguments[e++]);e=B.normalizeChildren(f);if("string"===typeof a){f=!1;var l,t;p=d.className||d["class"];for(var b in g.attrs)N.call(g.attrs,
b)&&(d[b]=g.attrs[b]);void 0!==p&&(void 0!==d["class"]&&(d["class"]=void 0,d.className=p),null!=g.attrs.className&&(d.className=g.attrs.className+" "+p));for(b in d)if(N.call(d,b)&&"key"!==b){f=!0;break}Array.isArray(e)&&1===e.length&&null!=e[0]&&"#"===e[0].tag?t=e[0].children:l=e;return B(g.tag,d.key,f?d:void 0,l,t)}return B(a,d.key,d,e)}function Q(a){var d=0,e=null,g="function"===typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(){var f=Date.now();0===d||16<=f-d?(d=f,
a()):null===e&&(e=g(function(){e=null;a();d=Date.now()},16-(f-d)))}}B.normalize=function(a){return Array.isArray(a)?B("[",void 0,void 0,B.normalizeChildren(a),void 0,void 0):null!=a&&"object"!==typeof a?B("#",void 0,void 0,!1===a?"":a,void 0,void 0):a};B.normalizeChildren=function(a){for(var d=0;d<a.length;d++)a[d]=B.normalize(a[d]);return a};var P=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,M={},N={}.hasOwnProperty;D.trust=function(a){null==a&&(a="");return B("<",
void 0,void 0,a,void 0,void 0)};D.fragment=function(a,d){return B("[",a.key,a,B.normalizeChildren(d),void 0,void 0)};var y=function(a){function d(a,b){return function E(d){var k;try{if(!b||null==d||"object"!==typeof d&&"function"!==typeof d||"function"!==typeof(k=d.then))l(function(){b||0!==a.length||console.error("Possible unhandled promise rejection:",d);for(var e=0;e<a.length;e++)a[e](d);f.length=0;p.length=0;m.state=b;m.retry=function(){E(d)}});else{if(d===g)throw new TypeError("Promise can't be resolved w/ itself");
e(k.bind(d))}}catch(R){q(R)}}}function e(a){function b(b){return function(a){0<d++||b(a)}}var d=0,e=b(q);try{a(b(k),e)}catch(E){e(E)}}if(!(this instanceof y))throw Error("Promise must be called with `new`");if("function"!==typeof a)throw new TypeError("executor must be a function");var g=this,f=[],p=[],k=d(f,!0),q=d(p,!1),m=g._instance={resolvers:f,rejectors:p},l="function"===typeof setImmediate?setImmediate:setTimeout;e(a)};y.prototype.then=function(a,d){function e(a,d,e,k){d.push(function(b){if("function"!==
typeof a)e(b);else try{f(a(b))}catch(v){p&&p(v)}});"function"===typeof g.retry&&k===g.state&&g.retry()}var g=this._instance,f,p,k=new y(function(a,d){f=a;p=d});e(a,g.resolvers,f,!0);e(d,g.rejectors,p,!1);return k};y.prototype["catch"]=function(a){return this.then(null,a)};y.resolve=function(a){return a instanceof y?a:new y(function(d){d(a)})};y.reject=function(a){return new y(function(d,e){e(a)})};y.all=function(a){return new y(function(d,e){var g=a.length,f=0,p=[];if(0===a.length)d([]);else for(var k=
0;k<a.length;k++)(function(k){function m(a){f++;p[k]=a;f===g&&d(p)}null==a[k]||"object"!==typeof a[k]&&"function"!==typeof a[k]||"function"!==typeof a[k].then?m(a[k]):a[k].then(m,e)})(k)})};y.race=function(a){return new y(function(d,e){for(var g=0;g<a.length;g++)a[g].then(d,e)})};"undefined"!==typeof window?("undefined"===typeof window.Promise&&(window.Promise=y),y=window.Promise):"undefined"!==typeof global&&("undefined"===typeof global.Promise&&(global.Promise=y),y=global.Promise);var G=function(a){function d(a,
g){if(Array.isArray(g))for(var f=0;f<g.length;f++)d(a+"["+f+"]",g[f]);else if("[object Object]"===Object.prototype.toString.call(g))for(f in g)d(a+"["+f+"]",g[f]);else e.push(encodeURIComponent(a)+(null!=g&&""!==g?"="+encodeURIComponent(g):""))}if("[object Object]"!==Object.prototype.toString.call(a))return"";var e=[],g;for(g in a)d(g,a[g]);return e.join("&")},S=/^file:\/\//i,K=function(a,d){function e(){function b(){0===--a&&"function"===typeof t&&t()}var a=0;return function x(d){var e=d.then;d.then=
function(){a++;var f=e.apply(d,arguments);f.then(b,function(d){b();if(0===a)throw d;});return x(f)};return d}}function g(b,a){if("string"===typeof b){var d=b;b=a||{};null==b.url&&(b.url=d)}return b}function f(b,a){if(null==a)return b;for(var d=b.match(/:[^\/]+/gi)||[],e=0;e<d.length;e++){var f=d[e].slice(1);null!=a[f]&&(b=b.replace(d[e],a[f]))}return b}function p(b,a){var d=G(a);if(""!==d){var e=0>b.indexOf("?")?"?":"&";b+=e+d}return b}function k(b){try{return""!==b?JSON.parse(b):null}catch(v){throw Error(b);
}}function q(b){return b.responseText}function m(b,a){if("function"===typeof b)if(Array.isArray(a))for(var d=0;d<a.length;d++)a[d]=new b(a[d]);else return new b(a);return a}var l=0,t;return{request:function(b,l){var t=e();b=g(b,l);var v=new d(function(d,e){null==b.method&&(b.method="GET");b.method=b.method.toUpperCase();var g="GET"===b.method||"TRACE"===b.method?!1:"boolean"===typeof b.useBody?b.useBody:!0;"function"!==typeof b.serialize&&(b.serialize="undefined"!==typeof FormData&&b.data instanceof
FormData?function(b){return b}:JSON.stringify);"function"!==typeof b.deserialize&&(b.deserialize=k);"function"!==typeof b.extract&&(b.extract=q);b.url=f(b.url,b.data);g?b.data=b.serialize(b.data):b.url=p(b.url,b.data);var l=new a.XMLHttpRequest,t=!1,v=l.abort;l.abort=function(){t=!0;v.call(l)};l.open(b.method,b.url,"boolean"===typeof b.async?b.async:!0,"string"===typeof b.user?b.user:void 0,"string"===typeof b.password?b.password:void 0);b.serialize!==JSON.stringify||!g||b.headers&&b.headers.hasOwnProperty("Content-Type")||
l.setRequestHeader("Content-Type","application/json; charset=utf-8");b.deserialize!==k||b.headers&&b.headers.hasOwnProperty("Accept")||l.setRequestHeader("Accept","application/json, text/*");b.withCredentials&&(l.withCredentials=b.withCredentials);for(var x in b.headers)({}).hasOwnProperty.call(b.headers,x)&&l.setRequestHeader(x,b.headers[x]);"function"===typeof b.config&&(l=b.config(l,b)||l);l.onreadystatechange=function(){if(!t&&4===l.readyState)try{var a=b.extract!==q?b.extract(l,b):b.deserialize(b.extract(l,
b));if(200<=l.status&&300>l.status||304===l.status||S.test(b.url))d(m(b.type,a));else{var h=Error(l.responseText),c;for(c in a)h[c]=a[c];e(h)}}catch(n){e(n)}};g&&null!=b.data?l.send(b.data):l.send()});return!0===b.background?v:t(v)},jsonp:function(b,k){var t=e();b=g(b,k);var q=new d(function(d,e){var g=b.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+l++,k=a.document.createElement("script");a[g]=function(e){k.parentNode.removeChild(k);d(m(b.type,e));delete a[g]};k.onerror=function(){k.parentNode.removeChild(k);
e(Error("JSONP request failed"));delete a[g]};null==b.data&&(b.data={});b.url=f(b.url,b.data);b.data[b.callbackKey||"callback"]=g;k.src=p(b.url,b.data);a.document.documentElement.appendChild(k)});return!0===b.background?q:t(q)},setCompletionCallback:function(b){t=b}}}(window,y),O=function(a){function d(h,c,n,b,a,d,g){for(;n<b;n++){var u=c[n];null!=u&&e(h,u,a,g,d)}}function e(h,c,n,b,a){var u=c.tag;if("string"===typeof u)switch(c.state={},null!=c.attrs&&D(c.attrs,c,n),u){case "#":return c.dom=A.createTextNode(c.children),
l(h,c.dom,a),c.dom;case "<":return g(h,c,a);case "[":var k=A.createDocumentFragment();null!=c.children&&(u=c.children,d(k,u,0,u.length,n,null,b));c.dom=k.firstChild;c.domSize=k.childNodes.length;l(h,k,a);return k;default:var m=c.tag,r=(u=c.attrs)&&u.is;m=(b=c.attrs&&c.attrs.xmlns||G[c.tag]||b)?r?A.createElementNS(b,m,{is:r}):A.createElementNS(b,m):r?A.createElement(m,{is:r}):A.createElement(m);c.dom=m;if(null!=u)for(k in r=b,u)E(c,k,null,u[k],r);l(h,m,a);null!=c.attrs&&null!=c.attrs.contenteditable?
t(c):(null!=c.text&&(""!==c.text?m.textContent=c.text:c.children=[B("#",void 0,void 0,c.text,void 0,void 0)]),null!=c.children&&(h=c.children,d(m,h,0,h.length,n,null,b),h=c.attrs,"select"===c.tag&&null!=h&&("value"in h&&E(c,"value",null,h.value,void 0),"selectedIndex"in h&&E(c,"selectedIndex",null,h.selectedIndex,void 0))));return m}else return f(c,n),null!=c.instance?(n=e(h,c.instance,n,b,a),c.dom=c.instance.dom,c.domSize=null!=c.dom?c.instance.domSize:0,l(h,n,a),c=n):(c.domSize=0,c=J),c}function g(h,
c,b){var n={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"}[(c.children.match(/^\s*?<(\w+)/im)||[])[1]]||"div";n=A.createElement(n);n.innerHTML=c.children;c.dom=n.firstChild;c.domSize=n.childNodes.length;c=A.createDocumentFragment();for(var a;a=n.firstChild;)c.appendChild(a);l(h,c,b);return c}function f(h,c){if("function"===typeof h.tag.view){h.state=Object.create(h.tag);var n=h.state.view;if(null!=n.$$reentrantLock$$)return J;
n.$$reentrantLock$$=!0}else{h.state=void 0;n=h.tag;if(null!=n.$$reentrantLock$$)return J;n.$$reentrantLock$$=!0;h.state=null!=h.tag.prototype&&"function"===typeof h.tag.prototype.view?new h.tag(h):h.tag(h)}h._state=h.state;null!=h.attrs&&D(h.attrs,h,c);D(h._state,h,c);h.instance=B.normalize(h._state.view.call(h.state,h));if(h.instance===h)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null}function p(h,c,n,a,g,f,p){if(c!==n&&(null!=c||null!=n))if(null==c)d(h,
n,0,n.length,g,f,p);else if(null==n)b(c,0,c.length,n);else{if(c.length===n.length){for(var u=!1,r=0;r<n.length;r++)if(null!=n[r]&&null!=c[r]){u=null==n[r].key&&null==c[r].key;break}if(u){for(r=0;r<c.length;r++)c[r]!==n[r]&&(null==c[r]&&null!=n[r]?e(h,n[r],g,p,m(c,r+1,f)):null==n[r]?b(c,r,r+1,n):k(h,c[r],n[r],g,m(c,r+1,f),a,p));return}}if(!a)a:{if(null!=c.pool&&Math.abs(c.pool.length-n.length)<=Math.abs(c.length-n.length)&&(a=n[0]&&n[0].children&&n[0].children.length||0,Math.abs((c.pool[0]&&c.pool[0].children&&
c.pool[0].children.length||0)-a)<=Math.abs((c[0]&&c[0].children&&c[0].children.length||0)-a))){a=!0;break a}a=!1}if(a){var t=c.pool;c=c.concat(c.pool)}r=u=0;for(var v=c.length-1,z=n.length-1,H;v>=u&&z>=r;){var w=c[u],x=n[r];if(w!==x||a)if(null==w)u++;else if(null==x)r++;else if(w.key===x.key){var C=null!=t&&u>=c.length-t.length||null==t&&a;u++;r++;k(h,w,x,g,m(c,u,f),C,p);a&&w.tag===x.tag&&l(h,q(w),f)}else if(w=c[v],w!==x||a)if(null==w)v--;else if(null==x)r++;else if(w.key===x.key)C=null!=t&&v>=c.length-
t.length||null==t&&a,k(h,w,x,g,m(c,v+1,f),C,p),(a||r<z)&&l(h,q(w),m(c,u,f)),v--,r++;else break;else v--,r++;else u++,r++}for(;v>=u&&z>=r;){w=c[v];x=n[z];if(w!==x||a)if(null==w)v--;else{if(null!=x)if(w.key===x.key)C=null!=t&&v>=c.length-t.length||null==t&&a,k(h,w,x,g,m(c,v+1,f),C,p),a&&w.tag===x.tag&&l(h,q(w),f),null!=w.dom&&(f=w.dom),v--;else{if(!H){H=c;w=v;C={};var A;for(A=0;A<w;A++){var y=H[A];null!=y&&(y=y.key,null!=y&&(C[y]=A))}H=C}null!=x&&(w=H[x.key],null!=w?(C=c[w],k(h,C,x,g,m(c,v+1,f),a,p),
l(h,q(C),f),c[w].skip=!0,null!=C.dom&&(f=C.dom)):f=e(h,x,g,p,f))}z--}else v--,z--;if(z<r)break}d(h,n,r,z+1,g,f,p);b(c,u,v+1,n)}}function k(h,c,a,b,d,m,l){var n=c.tag;if(n===a.tag){a.state=c.state;a._state=c._state;a.events=c.events;var u;if(u=!m){var w,C;null!=a.attrs&&"function"===typeof a.attrs.onbeforeupdate&&(w=a.attrs.onbeforeupdate.call(a.state,a,c));"string"!==typeof a.tag&&"function"===typeof a._state.onbeforeupdate&&(C=a._state.onbeforeupdate.call(a.state,a,c));void 0===w&&void 0===C||w||
C?u=!1:(a.dom=c.dom,a.domSize=c.domSize,a.instance=c.instance,u=!0)}if(!u)if("string"===typeof n)switch(null!=a.attrs&&(m?(a.state={},D(a.attrs,a,b)):I(a.attrs,a,b)),n){case "#":c.children.toString()!==a.children.toString()&&(c.dom.nodeValue=a.children);a.dom=c.dom;break;case "<":c.children!==a.children?(q(c),g(h,a,d)):(a.dom=c.dom,a.domSize=c.domSize);break;case "[":p(h,c.children,a.children,m,b,d,l);c=0;b=a.children;a.dom=null;if(null!=b){for(m=0;m<b.length;m++){var z=b[m];null!=z&&null!=z.dom&&
(null==a.dom&&(a.dom=z.dom),c+=z.domSize||1)}1!==c&&(a.domSize=c)}break;default:h=a.dom=c.dom;l=a.attrs&&a.attrs.xmlns||G[a.tag]||l;"textarea"===a.tag&&(null==a.attrs&&(a.attrs={}),null!=a.text&&(a.attrs.value=a.text,a.text=void 0));d=c.attrs;n=a.attrs;u=l;if(null!=n)for(z in n)E(a,z,d&&d[z],n[z],u);if(null!=d)for(z in d)null!=n&&z in n||("className"===z&&(z="class"),"o"!==z[0]||"n"!==z[1]||x(z)?"key"!==z&&a.dom.removeAttribute(z):y(a,z,void 0));null!=a.attrs&&null!=a.attrs.contenteditable?t(a):null!=
c.text&&null!=a.text&&""!==a.text?c.text.toString()!==a.text.toString()&&(c.dom.firstChild.nodeValue=a.text):(null!=c.text&&(c.children=[B("#",void 0,void 0,c.text,void 0,c.dom.firstChild)]),null!=a.text&&(a.children=[B("#",void 0,void 0,a.text,void 0,void 0)]),p(h,c.children,a.children,m,b,null,l))}else{if(m)f(a,b);else{a.instance=B.normalize(a._state.view.call(a.state,a));if(a.instance===a)throw Error("A view cannot return the vnode it received as argument");null!=a.attrs&&I(a.attrs,a,b);I(a._state,
a,b)}null!=a.instance?(null==c.instance?e(h,a.instance,b,l,d):k(h,c.instance,a.instance,b,d,m,l),a.dom=a.instance.dom,a.domSize=a.instance.domSize):null!=c.instance?(v(c.instance,null),a.dom=void 0,a.domSize=0):(a.dom=c.dom,a.domSize=c.domSize)}}else v(c,null),e(h,a,b,l,d)}function q(a){var c=a.domSize;if(null!=c||null==a.dom){var b=A.createDocumentFragment();if(0<c){for(a=a.dom;--c;)b.appendChild(a.nextSibling);b.insertBefore(a,b.firstChild)}return b}return a.dom}function m(a,c,b){for(;c<a.length;c++)if(null!=
a[c]&&null!=a[c].dom)return a[c].dom;return b}function l(a,c,b){b&&b.parentNode?a.insertBefore(c,b):a.appendChild(c)}function t(a){var c=a.children;if(null!=c&&1===c.length&&"<"===c[0].tag)c=c[0].children,a.dom.innerHTML!==c&&(a.dom.innerHTML=c);else if(null!=a.text||null!=c&&0!==c.length)throw Error("Child node of a contenteditable must be trusted");}function b(a,c,b,d){for(;c<b;c++){var h=a[c];null!=h&&(h.skip?h.skip=!1:v(h,d))}}function v(a,c){function b(){if(++d===h&&(C(a),a.dom)){var b=a.domSize||
1;if(1<b)for(var f=a.dom;--b;){var g=f.nextSibling,e=g.parentNode;null!=e&&e.removeChild(g)}b=a.dom;f=b.parentNode;null!=f&&f.removeChild(b);if(b=null!=c&&null==a.domSize)b=a.attrs,b=!(null!=b&&(b.oncreate||b.onupdate||b.onbeforeremove||b.onremove));b&&"string"===typeof a.tag&&(c.pool?c.pool.push(a):c.pool=[a])}}var h=1,d=0;if(a.attrs&&"function"===typeof a.attrs.onbeforeremove){var f=a.attrs.onbeforeremove.call(a.state,a);null!=f&&"function"===typeof f.then&&(h++,f.then(b,b))}"string"!==typeof a.tag&&
"function"===typeof a._state.onbeforeremove&&(f=a._state.onbeforeremove.call(a.state,a),null!=f&&"function"===typeof f.then&&(h++,f.then(b,b)));b()}function C(a){a.attrs&&"function"===typeof a.attrs.onremove&&a.attrs.onremove.call(a.state,a);"string"!==typeof a.tag&&"function"===typeof a._state.onremove&&a._state.onremove.call(a.state,a);if(null!=a.instance)C(a.instance);else if(a=a.children,Array.isArray(a))for(var c=0;c<a.length;c++){var b=a[c];null!=b&&C(b)}}function E(a,c,b,d,f){var h=a.dom;if("key"!==
c&&"is"!==c&&(b!==d||"value"===c||"checked"===c||"selectedIndex"===c||"selected"===c&&a.dom===A.activeElement||"object"===typeof d)&&"undefined"!==typeof d&&!x(c)){var g=c.indexOf(":");if(-1<g&&"xlink"===c.substr(0,g))h.setAttributeNS("http://www.w3.org/1999/xlink",c.slice(g+1),d);else if("o"===c[0]&&"n"===c[1]&&"function"===typeof d)y(a,c,d);else if("style"===c)if(a=b,a===d&&(h.style.cssText="",a=null),null==d)h.style.cssText="";else if("string"===typeof d)h.style.cssText=d;else{"string"===typeof a&&
(h.style.cssText="");for(var e in d)h.style[e]=d[e];if(null!=a&&"string"!==typeof a)for(e in a)e in d||(h.style[e]="")}else if(c in h&&"href"!==c&&"list"!==c&&"form"!==c&&"width"!==c&&"height"!==c&&void 0===f&&!(a.attrs.is||-1<a.tag.indexOf("-"))){if("value"===c){e=""+d;if(("input"===a.tag||"textarea"===a.tag)&&a.dom.value===e&&a.dom===A.activeElement)return;if("select"===a.tag)if(null===d){if(-1===a.dom.selectedIndex&&a.dom===A.activeElement)return}else if(null!==b&&a.dom.value===e&&a.dom===A.activeElement)return;
if("option"===a.tag&&null!=b&&a.dom.value===e)return}"input"===a.tag&&"type"===c?h.setAttribute(c,d):h[c]=d}else"boolean"===typeof d?d?h.setAttribute(c,""):h.removeAttribute(c):h.setAttribute("className"===c?"class":c,d)}}function x(a){return"oninit"===a||"oncreate"===a||"onupdate"===a||"onremove"===a||"onbeforeremove"===a||"onbeforeupdate"===a}function y(a,c,b){var d=a.dom,f="function"!==typeof F?b:function(a){var c=b.call(d,a);F.call(d,a);return c};if(c in d)d[c]="function"===typeof b?f:null;else{var h=
c.slice(2);void 0===a.events&&(a.events={});a.events[c]!==f&&(null!=a.events[c]&&d.removeEventListener(h,a.events[c],!1),"function"===typeof b&&(a.events[c]=f,d.addEventListener(h,a.events[c],!1)))}}function D(a,b,d){"function"===typeof a.oninit&&a.oninit.call(b.state,b);"function"===typeof a.oncreate&&d.push(a.oncreate.bind(b.state,b))}function I(a,b,d){"function"===typeof a.onupdate&&d.push(a.onupdate.bind(b.state,b))}var A=a.document,J=A.createDocumentFragment(),G={svg:"http://www.w3.org/2000/svg",
math:"http://www.w3.org/1998/Math/MathML"},F;return{render:function(a,b){if(!a)throw Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var c=[],d=A.activeElement,f=a.namespaceURI;null==a.vnodes&&(a.textContent="");Array.isArray(b)||(b=[b]);p(a,a.vnodes,B.normalizeChildren(b),!1,c,null,"http://www.w3.org/1999/xhtml"===f?void 0:f);a.vnodes=b;for(f=0;f<c.length;f++)c[f]();null!=d&&A.activeElement!==d&&d.focus()},setEventCallback:function(a){return F=a}}},F=function(a){function d(a){a=
g.indexOf(a);-1<a&&g.splice(a,2)}function e(){for(var a=1;a<g.length;a+=2)g[a]()}a=O(a);a.setEventCallback(function(a){!1===a.redraw?a.redraw=void 0:e()});var g=[];return{subscribe:function(a,e){d(a);g.push(a,Q(e))},unsubscribe:d,redraw:e,render:a.render}}(window);K.setCompletionCallback(F.redraw);D.mount=function(a){return function(d,e){if(null===e)a.render(d,[]),a.unsubscribe(d);else{if(null==e.view&&"function"!==typeof e)throw Error("m.mount(element, component) expects a component, not a vnode");
a.subscribe(d,function(){a.render(d,B(e))});a.redraw()}}}(F);var T=y,L=function(a){if(""===a||null==a)return{};"?"===a.charAt(0)&&(a=a.slice(1));a=a.split("&");for(var d={},e={},g=0;g<a.length;g++){var f=a[g].split("="),p=decodeURIComponent(f[0]);f=2===f.length?decodeURIComponent(f[1]):"";"true"===f?f=!0:"false"===f&&(f=!1);var k=p.split(/\]\[?|\[/),q=d;-1<p.indexOf("[")&&k.pop();for(var m=0;m<k.length;m++){p=k[m];var l=k[m+1];l=""==l||!isNaN(parseInt(l,10));var t=m===k.length-1;""===p&&(p=k.slice(0,
m).join(),null==e[p]&&(e[p]=0),p=e[p]++);null==q[p]&&(q[p]=t?f:l?[]:{});q=q[p]}}return d},U=function(a){function d(d){var f=a.location[d].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===d&&"/"!==f[0]&&(f="/"+f);return f}function e(a){return function(){null==k&&(k=p(function(){k=null;a()}))}}function g(a,d,f){var b=a.indexOf("?"),e=a.indexOf("#"),g=-1<b?b:-1<e?e:a.length;if(-1<b){b=L(a.slice(b+1,-1<e?e:a.length));for(var k in b)d[k]=b[k]}if(-1<e)for(k in d=L(a.slice(e+1)),d)f[k]=
d[k];return a.slice(0,g)}var f="function"===typeof a.history.pushState,p="function"===typeof setImmediate?setImmediate:setTimeout,k,q={prefix:"#!",getPath:function(){switch(q.prefix.charAt(0)){case "#":return d("hash").slice(q.prefix.length);case "?":return d("search").slice(q.prefix.length)+d("hash");default:return d("pathname").slice(q.prefix.length)+d("search")+d("hash")}},setPath:function(d,e,k){var b={},l={};d=g(d,b,l);if(null!=e){for(var m in e)b[m]=e[m];d=d.replace(/:([^\/]+)/g,function(a,
d){delete b[d];return e[d]})}(m=G(b))&&(d+="?"+m);(l=G(l))&&(d+="#"+l);f?(l=k?k.state:null,m=k?k.title:null,a.onpopstate(),k&&k.replace?a.history.replaceState(l,m,q.prefix+d):a.history.pushState(l,m,q.prefix+d)):a.location.href=q.prefix+d},defineRoutes:function(d,k,p){function b(){var b=q.getPath(),e={},f=g(b,e,e),l=a.history.state;if(null!=l)for(var m in l)e[m]=l[m];for(var t in d)if(l=new RegExp("^"+t.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),l.test(f)){f.replace(l,
function(){for(var a=t.match(/:[^\/]+/g)||[],f=[].slice.call(arguments,1,-2),g=0;g<a.length;g++)e[a[g].replace(/:|\./g,"")]=decodeURIComponent(f[g]);k(d[t],e,b,t)});return}p(b,e)}f?a.onpopstate=e(b):"#"===q.prefix.charAt(0)&&(a.onhashchange=b);b()}};return q};D.route=function(a,d){var e=U(a),g=function(a){return a},f,p,k,q,m,l=function(a,b,l){if(null==a)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var t=function(){null!=f&&d.render(a,f(B(p,k.key,k)))},v=function(a){if(a!==
b)e.setPath(b,null,{replace:!0});else throw Error("Could not resolve default route "+b);};e.defineRoutes(l,function(a,b,d){var e=m=function(a,l){e===m&&(p=null==l||"function"!==typeof l.view&&"function"!==typeof l?"div":l,k=b,q=d,m=null,f=(a.render||g).bind(a),t())};a.view||"function"===typeof a?e({},a):a.onmatch?T.resolve(a.onmatch(b,d)).then(function(b){e(a,b)},v):e(a,"div")},v);d.subscribe(a,t)};l.set=function(a,b,d){null!=m&&(d=d||{},d.replace=!0);m=null;e.setPath(a,b,d)};l.get=function(){return q};
l.prefix=function(a){e.prefix=a};l.link=function(a){a.dom.setAttribute("href",e.prefix+a.attrs.href);a.dom.onclick=function(a){a.ctrlKey||a.metaKey||a.shiftKey||2===a.which||(a.preventDefault(),a.redraw=!1,a=this.getAttribute("href"),0===a.indexOf(e.prefix)&&(a=a.slice(e.prefix.length)),l.set(a,void 0,void 0))}};l.param=function(a){return"undefined"!==typeof k&&"undefined"!==typeof a?k[a]:k};return l}(window,F);D.withAttr=function(a,d,e){return function(g){d.call(e||this,a in g.currentTarget?g.currentTarget[a]:
g.currentTarget.getAttribute(a))}};var V=O(window);D.render=V.render;D.redraw=F.redraw;D.request=K.request;D.jsonp=K.jsonp;D.parseQueryString=L;D.buildQueryString=G;D.version="1.1.5";D.vnode=B;"undefined"!==typeof module?module.exports=D:window.m=D})();
(function(){function B(b,d,f,g,e,n){return{tag:b,key:d,attrs:f,children:g,text:e,dom:n,domSize:void 0,state:void 0,_state:void 0,events:void 0,instance:void 0,skip:!1}}function N(b){for(var d in b)if(G.call(b,d))return!1;return!0}function D(b){var d=arguments[1],f=2;if(null==b||"string"!==typeof b&&"function"!==typeof b&&"function"!==typeof b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b){var g;if(!(g=O[b])){var e="div";for(var n=[],h={};g=Q.exec(b);){var q=
g[1],m=g[2];""===q&&""!==m?e=m:"#"===q?h.id=m:"."===q?n.push(m):"["===g[3][0]&&((q=g[6])&&(q=q.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===g[4]?n.push(q):h[g[4]]=""===q?q:q||!0)}0<n.length&&(h.className=n.join(" "));g=O[b]={tag:e,attrs:h}}}if(null==d)d={};else if("object"!==typeof d||null!=d.tag||Array.isArray(d))d={},f=1;if(arguments.length===f+1)e=arguments[f],Array.isArray(e)||(e=[e]);else for(e=[];f<arguments.length;)e.push(arguments[f++]);f=B.normalizeChildren(e);if("string"===
typeof b){e=!1;var k,t;n=d.className||d["class"];if(!N(g.attrs)&&!N(d)){h={};for(var a in d)G.call(d,a)&&(h[a]=d[a]);d=h}for(a in g.attrs)G.call(g.attrs,a)&&(d[a]=g.attrs[a]);void 0!==n&&(void 0!==d["class"]&&(d["class"]=void 0,d.className=n),null!=g.attrs.className&&(d.className=g.attrs.className+" "+n));for(a in d)if(G.call(d,a)&&"key"!==a){e=!0;break}Array.isArray(f)&&1===f.length&&null!=f[0]&&"#"===f[0].tag?t=f[0].children:k=f;return B(g.tag,d.key,e?d:void 0,k,t)}return B(b,d.key,d,f)}function R(b){var d=
0,f=null,g="function"===typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(){var e=Date.now();0===d||16<=e-d?(d=e,b()):null===f&&(f=g(function(){f=null;b();d=Date.now()},16-(e-d)))}}B.normalize=function(b){return Array.isArray(b)?B("[",void 0,void 0,B.normalizeChildren(b),void 0,void 0):null!=b&&"object"!==typeof b?B("#",void 0,void 0,!1===b?"":b,void 0,void 0):b};B.normalizeChildren=function(b){for(var d=0;d<b.length;d++)b[d]=B.normalize(b[d]);return b};var Q=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,
O={},G={}.hasOwnProperty;D.trust=function(b){null==b&&(b="");return B("<",void 0,void 0,b,void 0,void 0)};D.fragment=function(b,d){return B("[",b.key,b,B.normalizeChildren(d),void 0,void 0)};var x=function(b){function d(b,a){return function E(d){var h;try{if(!a||null==d||"object"!==typeof d&&"function"!==typeof d||"function"!==typeof(h=d.then))k(function(){a||0!==b.length||console.error("Possible unhandled promise rejection:",d);for(var f=0;f<b.length;f++)b[f](d);e.length=0;n.length=0;m.state=a;m.retry=
function(){E(d)}});else{if(d===g)throw new TypeError("Promise can't be resolved w/ itself");f(h.bind(d))}}catch(S){q(S)}}}function f(b){function a(a){return function(b){0<d++||a(b)}}var d=0,f=a(q);try{b(a(h),f)}catch(E){f(E)}}if(!(this instanceof x))throw Error("Promise must be called with `new`");if("function"!==typeof b)throw new TypeError("executor must be a function");var g=this,e=[],n=[],h=d(e,!0),q=d(n,!1),m=g._instance={resolvers:e,rejectors:n},k="function"===typeof setImmediate?setImmediate:
setTimeout;f(b)};x.prototype.then=function(b,d){function f(b,d,f,h){d.push(function(a){if("function"!==typeof b)f(a);else try{e(b(a))}catch(w){n&&n(w)}});"function"===typeof g.retry&&h===g.state&&g.retry()}var g=this._instance,e,n,h=new x(function(b,d){e=b;n=d});f(b,g.resolvers,e,!0);f(d,g.rejectors,n,!1);return h};x.prototype["catch"]=function(b){return this.then(null,b)};x.resolve=function(b){return b instanceof x?b:new x(function(d){d(b)})};x.reject=function(b){return new x(function(d,f){f(b)})};
x.all=function(b){return new x(function(d,f){var g=b.length,e=0,n=[];if(0===b.length)d([]);else for(var h=0;h<b.length;h++)(function(h){function m(b){e++;n[h]=b;e===g&&d(n)}null==b[h]||"object"!==typeof b[h]&&"function"!==typeof b[h]||"function"!==typeof b[h].then?m(b[h]):b[h].then(m,f)})(h)})};x.race=function(b){return new x(function(d,f){for(var g=0;g<b.length;g++)b[g].then(d,f)})};"undefined"!==typeof window?("undefined"===typeof window.Promise&&(window.Promise=x),x=window.Promise):"undefined"!==
typeof global&&("undefined"===typeof global.Promise&&(global.Promise=x),x=global.Promise);var F=function(b){function d(b,g){if(Array.isArray(g))for(var e=0;e<g.length;e++)d(b+"["+e+"]",g[e]);else if("[object Object]"===Object.prototype.toString.call(g))for(e in g)d(b+"["+e+"]",g[e]);else f.push(encodeURIComponent(b)+(null!=g&&""!==g?"="+encodeURIComponent(g):""))}if("[object Object]"!==Object.prototype.toString.call(b))return"";var f=[],g;for(g in b)d(g,b[g]);return f.join("&")},T=/^file:\/\//i,L=
function(b,d){function f(){function a(){0===--b&&"function"===typeof t&&t()}var b=0;return function u(d){var f=d.then;d.then=function(){b++;var e=f.apply(d,arguments);e.then(a,function(d){a();if(0===b)throw d;});return u(e)};return d}}function g(a,b){if("string"===typeof a){var d=a;a=b||{};null==a.url&&(a.url=d)}return a}function e(a,b){if(null==b)return a;for(var d=a.match(/:[^\/]+/gi)||[],f=0;f<d.length;f++){var e=d[f].slice(1);null!=b[e]&&(a=a.replace(d[f],b[e]))}return a}function n(a,b){var d=
F(b);if(""!==d){var f=0>a.indexOf("?")?"?":"&";a+=f+d}return a}function h(a){try{return""!==a?JSON.parse(a):null}catch(w){throw Error(a);}}function q(a){return a.responseText}function m(a,b){if("function"===typeof a)if(Array.isArray(b))for(var d=0;d<b.length;d++)b[d]=new a(b[d]);else return new a(b);return b}var k=0,t;return{request:function(a,k){var t=f();a=g(a,k);var w=new d(function(d,f){null==a.method&&(a.method="GET");a.method=a.method.toUpperCase();var g="GET"===a.method||"TRACE"===a.method?
!1:"boolean"===typeof a.useBody?a.useBody:!0;"function"!==typeof a.serialize&&(a.serialize="undefined"!==typeof FormData&&a.data instanceof FormData?function(a){return a}:JSON.stringify);"function"!==typeof a.deserialize&&(a.deserialize=h);"function"!==typeof a.extract&&(a.extract=q);a.url=e(a.url,a.data);g?a.data=a.serialize(a.data):a.url=n(a.url,a.data);var k=new b.XMLHttpRequest,t=!1,w=k.abort;k.abort=function(){t=!0;w.call(k)};k.open(a.method,a.url,"boolean"===typeof a.async?a.async:!0,"string"===
typeof a.user?a.user:void 0,"string"===typeof a.password?a.password:void 0);a.serialize!==JSON.stringify||!g||a.headers&&a.headers.hasOwnProperty("Content-Type")||k.setRequestHeader("Content-Type","application/json; charset=utf-8");a.deserialize!==h||a.headers&&a.headers.hasOwnProperty("Accept")||k.setRequestHeader("Accept","application/json, text/*");a.withCredentials&&(k.withCredentials=a.withCredentials);for(var u in a.headers)({}).hasOwnProperty.call(a.headers,u)&&k.setRequestHeader(u,a.headers[u]);
"function"===typeof a.config&&(k=a.config(k,a)||k);k.onreadystatechange=function(){if(!t&&4===k.readyState)try{var b=a.extract!==q?a.extract(k,a):a.deserialize(a.extract(k,a));if(200<=k.status&&300>k.status||304===k.status||T.test(a.url))d(m(a.type,b));else{var l=Error(k.responseText),c;for(c in b)l[c]=b[c];f(l)}}catch(p){f(p)}};g&&null!=a.data?k.send(a.data):k.send()});return!0===a.background?w:t(w)},jsonp:function(a,h){var t=f();a=g(a,h);var q=new d(function(d,f){var g=a.callbackName||"_mithril_"+
Math.round(1E16*Math.random())+"_"+k++,h=b.document.createElement("script");b[g]=function(f){h.parentNode.removeChild(h);d(m(a.type,f));delete b[g]};h.onerror=function(){h.parentNode.removeChild(h);f(Error("JSONP request failed"));delete b[g]};null==a.data&&(a.data={});a.url=e(a.url,a.data);a.data[a.callbackKey||"callback"]=g;h.src=n(a.url,a.data);b.document.documentElement.appendChild(h)});return!0===a.background?q:t(q)},setCompletionCallback:function(a){t=a}}}(window,x),P=function(b){function d(l,
c,p,a,b,d,g){for(;p<a;p++){var v=c[p];null!=v&&f(l,v,b,g,d)}}function f(l,c,p,a,b){var v=c.tag;if("string"===typeof v)switch(c.state={},null!=c.attrs&&D(c.attrs,c,p),v){case "#":return c.dom=A.createTextNode(c.children),k(l,c.dom,b),c.dom;case "<":return g(l,c,b);case "[":var h=A.createDocumentFragment();null!=c.children&&(v=c.children,d(h,v,0,v.length,p,null,a));c.dom=h.firstChild;c.domSize=h.childNodes.length;k(l,h,b);return h;default:var m=c.tag,r=(v=c.attrs)&&v.is;m=(a=c.attrs&&c.attrs.xmlns||
G[c.tag]||a)?r?A.createElementNS(a,m,{is:r}):A.createElementNS(a,m):r?A.createElement(m,{is:r}):A.createElement(m);c.dom=m;if(null!=v)for(h in r=a,v)E(c,h,null,v[h],r);k(l,m,b);null!=c.attrs&&null!=c.attrs.contenteditable?t(c):(null!=c.text&&(""!==c.text?m.textContent=c.text:c.children=[B("#",void 0,void 0,c.text,void 0,void 0)]),null!=c.children&&(l=c.children,d(m,l,0,l.length,p,null,a),l=c.attrs,"select"===c.tag&&null!=l&&("value"in l&&E(c,"value",null,l.value,void 0),"selectedIndex"in l&&E(c,"selectedIndex",
null,l.selectedIndex,void 0))));return m}else return e(c,p),null!=c.instance?(p=f(l,c.instance,p,a,b),c.dom=c.instance.dom,c.domSize=null!=c.dom?c.instance.domSize:0,k(l,p,b),c=p):(c.domSize=0,c=K),c}function g(l,c,a){var p={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"}[(c.children.match(/^\s*?<(\w+)/im)||[])[1]]||"div";p=A.createElement(p);p.innerHTML=c.children;c.dom=p.firstChild;c.domSize=p.childNodes.length;c=A.createDocumentFragment();
for(var b;b=p.firstChild;)c.appendChild(b);k(l,c,a);return c}function e(l,c){if("function"===typeof l.tag.view){l.state=Object.create(l.tag);var a=l.state.view;if(null!=a.$$reentrantLock$$)return K;a.$$reentrantLock$$=!0}else{l.state=void 0;a=l.tag;if(null!=a.$$reentrantLock$$)return K;a.$$reentrantLock$$=!0;l.state=null!=l.tag.prototype&&"function"===typeof l.tag.prototype.view?new l.tag(l):l.tag(l)}l._state=l.state;null!=l.attrs&&D(l.attrs,l,c);D(l._state,l,c);l.instance=B.normalize(l._state.view.call(l.state,
l));if(l.instance===l)throw Error("A view cannot return the vnode it received as argument");a.$$reentrantLock$$=null}function n(l,c,p,b,g,e,n){if(c!==p&&(null!=c||null!=p))if(null==c)d(l,p,0,p.length,g,e,n);else if(null==p)a(c,0,c.length,p);else{if(c.length===p.length){for(var v=!1,r=0;r<p.length;r++)if(null!=p[r]&&null!=c[r]){v=null==p[r].key&&null==c[r].key;break}if(v){for(r=0;r<c.length;r++)c[r]!==p[r]&&(null==c[r]&&null!=p[r]?f(l,p[r],g,n,m(c,r+1,e)):null==p[r]?a(c,r,r+1,p):h(l,c[r],p[r],g,m(c,
r+1,e),b,n));return}}if(!b)a:{if(null!=c.pool&&Math.abs(c.pool.length-p.length)<=Math.abs(c.length-p.length)&&(b=p[0]&&p[0].children&&p[0].children.length||0,Math.abs((c.pool[0]&&c.pool[0].children&&c.pool[0].children.length||0)-b)<=Math.abs((c[0]&&c[0].children&&c[0].children.length||0)-b))){b=!0;break a}b=!1}if(b){var t=c.pool;c=c.concat(c.pool)}r=v=0;for(var w=c.length-1,y=p.length-1,H;w>=v&&y>=r;){var u=c[v],z=p[r];if(u!==z||b)if(null==u)v++;else if(null==z)r++;else if(u.key===z.key){var C=null!=
t&&v>=c.length-t.length||null==t&&b;v++;r++;h(l,u,z,g,m(c,v,e),C,n);b&&u.tag===z.tag&&k(l,q(u),e)}else if(u=c[w],u!==z||b)if(null==u)w--;else if(null==z)r++;else if(u.key===z.key)C=null!=t&&w>=c.length-t.length||null==t&&b,h(l,u,z,g,m(c,w+1,e),C,n),(b||r<y)&&k(l,q(u),m(c,v,e)),w--,r++;else break;else w--,r++;else v++,r++}for(;w>=v&&y>=r;){u=c[w];z=p[y];if(u!==z||b)if(null==u)w--;else{if(null!=z)if(u.key===z.key)C=null!=t&&w>=c.length-t.length||null==t&&b,h(l,u,z,g,m(c,w+1,e),C,n),b&&u.tag===z.tag&&
k(l,q(u),e),null!=u.dom&&(e=u.dom),w--;else{if(!H){H=c;u=w;C={};var A;for(A=0;A<u;A++){var x=H[A];null!=x&&(x=x.key,null!=x&&(C[x]=A))}H=C}null!=z&&(u=H[z.key],null!=u?(C=c[u],h(l,C,z,g,m(c,w+1,e),b,n),k(l,q(C),e),c[u].skip=!0,null!=C.dom&&(e=C.dom)):e=f(l,z,g,n,e))}y--}else w--,y--;if(y<r)break}d(l,p,r,y+1,g,e,n);a(c,v,w+1,p)}}function h(l,c,a,b,d,m,k){var p=c.tag;if(p===a.tag){a.state=c.state;a._state=c._state;a.events=c.events;var v;if(v=!m){var C,z;null!=a.attrs&&"function"===typeof a.attrs.onbeforeupdate&&
(C=a.attrs.onbeforeupdate.call(a.state,a,c));"string"!==typeof a.tag&&"function"===typeof a._state.onbeforeupdate&&(z=a._state.onbeforeupdate.call(a.state,a,c));void 0===C&&void 0===z||C||z?v=!1:(a.dom=c.dom,a.domSize=c.domSize,a.instance=c.instance,v=!0)}if(!v)if("string"===typeof p)switch(null!=a.attrs&&(m?(a.state={},D(a.attrs,a,b)):J(a.attrs,a,b)),p){case "#":c.children.toString()!==a.children.toString()&&(c.dom.nodeValue=a.children);a.dom=c.dom;break;case "<":c.children!==a.children?(q(c),g(l,
a,d)):(a.dom=c.dom,a.domSize=c.domSize);break;case "[":n(l,c.children,a.children,m,b,d,k);c=0;b=a.children;a.dom=null;if(null!=b){for(m=0;m<b.length;m++){var y=b[m];null!=y&&null!=y.dom&&(null==a.dom&&(a.dom=y.dom),c+=y.domSize||1)}1!==c&&(a.domSize=c)}break;default:l=a.dom=c.dom;k=a.attrs&&a.attrs.xmlns||G[a.tag]||k;"textarea"===a.tag&&(null==a.attrs&&(a.attrs={}),null!=a.text&&(a.attrs.value=a.text,a.text=void 0));d=c.attrs;p=a.attrs;v=k;if(null!=p)for(y in p)E(a,y,d&&d[y],p[y],v);if(null!=d)for(y in d)null!=
p&&y in p||("className"===y&&(y="class"),"o"!==y[0]||"n"!==y[1]||u(y)?"key"!==y&&a.dom.removeAttribute(y):x(a,y,void 0));null!=a.attrs&&null!=a.attrs.contenteditable?t(a):null!=c.text&&null!=a.text&&""!==a.text?c.text.toString()!==a.text.toString()&&(c.dom.firstChild.nodeValue=a.text):(null!=c.text&&(c.children=[B("#",void 0,void 0,c.text,void 0,c.dom.firstChild)]),null!=a.text&&(a.children=[B("#",void 0,void 0,a.text,void 0,void 0)]),n(l,c.children,a.children,m,b,null,k))}else{if(m)e(a,b);else{a.instance=
B.normalize(a._state.view.call(a.state,a));if(a.instance===a)throw Error("A view cannot return the vnode it received as argument");null!=a.attrs&&J(a.attrs,a,b);J(a._state,a,b)}null!=a.instance?(null==c.instance?f(l,a.instance,b,k,d):h(l,c.instance,a.instance,b,d,m,k),a.dom=a.instance.dom,a.domSize=a.instance.domSize):null!=c.instance?(w(c.instance,null),a.dom=void 0,a.domSize=0):(a.dom=c.dom,a.domSize=c.domSize)}}else w(c,null),f(l,a,b,k,d)}function q(a){var c=a.domSize;if(null!=c||null==a.dom){var b=
A.createDocumentFragment();if(0<c){for(a=a.dom;--c;)b.appendChild(a.nextSibling);b.insertBefore(a,b.firstChild)}return b}return a.dom}function m(a,c,b){for(;c<a.length;c++)if(null!=a[c]&&null!=a[c].dom)return a[c].dom;return b}function k(a,c,b){b&&b.parentNode?a.insertBefore(c,b):a.appendChild(c)}function t(a){var c=a.children;if(null!=c&&1===c.length&&"<"===c[0].tag)c=c[0].children,a.dom.innerHTML!==c&&(a.dom.innerHTML=c);else if(null!=a.text||null!=c&&0!==c.length)throw Error("Child node of a contenteditable must be trusted");
}function a(a,c,b,d){for(;c<b;c++){var l=a[c];null!=l&&(l.skip?l.skip=!1:w(l,d))}}function w(a,c){function b(){if(++d===l&&(C(a),a.dom)){var b=a.domSize||1;if(1<b)for(var e=a.dom;--b;){var g=e.nextSibling,f=g.parentNode;null!=f&&f.removeChild(g)}b=a.dom;e=b.parentNode;null!=e&&e.removeChild(b);if(b=null!=c&&null==a.domSize)b=a.attrs,b=!(null!=b&&(b.oncreate||b.onupdate||b.onbeforeremove||b.onremove));b&&"string"===typeof a.tag&&(c.pool?c.pool.push(a):c.pool=[a])}}var l=1,d=0;if(a.attrs&&"function"===
typeof a.attrs.onbeforeremove){var e=a.attrs.onbeforeremove.call(a.state,a);null!=e&&"function"===typeof e.then&&(l++,e.then(b,b))}"string"!==typeof a.tag&&"function"===typeof a._state.onbeforeremove&&(e=a._state.onbeforeremove.call(a.state,a),null!=e&&"function"===typeof e.then&&(l++,e.then(b,b)));b()}function C(a){a.attrs&&"function"===typeof a.attrs.onremove&&a.attrs.onremove.call(a.state,a);if("string"!==typeof a.tag)"function"===typeof a._state.onremove&&a._state.onremove.call(a.state,a),null!=
a.instance&&C(a.instance);else if(a=a.children,Array.isArray(a))for(var c=0;c<a.length;c++){var b=a[c];null!=b&&C(b)}}function E(a,b,d,e,g){var c=a.dom;if("key"!==b&&"is"!==b&&(d!==e||"value"===b||"checked"===b||"selectedIndex"===b||"selected"===b&&a.dom===A.activeElement||"object"===typeof e)&&"undefined"!==typeof e&&!u(b)){var l=b.indexOf(":");if(-1<l&&"xlink"===b.substr(0,l))c.setAttributeNS("http://www.w3.org/1999/xlink",b.slice(l+1),e);else if("o"===b[0]&&"n"===b[1]&&"function"===typeof e)x(a,
b,e);else if("style"===b)if(a=d,a===e&&(c.style.cssText="",a=null),null==e)c.style.cssText="";else if("string"===typeof e)c.style.cssText=e;else{"string"===typeof a&&(c.style.cssText="");for(var f in e)c.style[f]=e[f];if(null!=a&&"string"!==typeof a)for(f in a)f in e||(c.style[f]="")}else if(b in c&&"href"!==b&&"list"!==b&&"form"!==b&&"width"!==b&&"height"!==b&&void 0===g&&!(a.attrs.is||-1<a.tag.indexOf("-"))){if("value"===b){f=""+e;if(("input"===a.tag||"textarea"===a.tag)&&a.dom.value===f&&a.dom===
A.activeElement)return;if("select"===a.tag)if(null===e){if(-1===a.dom.selectedIndex&&a.dom===A.activeElement)return}else if(null!==d&&a.dom.value===f&&a.dom===A.activeElement)return;if("option"===a.tag&&null!=d&&a.dom.value===f)return}"input"===a.tag&&"type"===b?c.setAttribute(b,e):c[b]=e}else"boolean"===typeof e?e?c.setAttribute(b,""):c.removeAttribute(b):c.setAttribute("className"===b?"class":b,e)}}function u(a){return"oninit"===a||"oncreate"===a||"onupdate"===a||"onremove"===a||"onbeforeremove"===
a||"onbeforeupdate"===a}function x(a,b,d){var c=a.dom,e="function"!==typeof F?d:function(a){var b=d.call(c,a);F.call(c,a);return b};if(b in c)c[b]="function"===typeof d?e:null;else{var f=b.slice(2);void 0===a.events&&(a.events={});a.events[b]!==e&&(null!=a.events[b]&&c.removeEventListener(f,a.events[b],!1),"function"===typeof d&&(a.events[b]=e,c.addEventListener(f,a.events[b],!1)))}}function D(a,b,d){"function"===typeof a.oninit&&a.oninit.call(b.state,b);"function"===typeof a.oncreate&&d.push(a.oncreate.bind(b.state,
b))}function J(a,b,d){"function"===typeof a.onupdate&&d.push(a.onupdate.bind(b.state,b))}var A=b.document,K=A.createDocumentFragment(),G={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},F;return{render:function(a,b){if(!a)throw Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var c=[],d=A.activeElement,e=a.namespaceURI;null==a.vnodes&&(a.textContent="");Array.isArray(b)||(b=[b]);n(a,a.vnodes,B.normalizeChildren(b),!1,c,null,"http://www.w3.org/1999/xhtml"===
e?void 0:e);a.vnodes=b;null!=d&&A.activeElement!==d&&d.focus();for(d=0;d<c.length;d++)c[d]()},setEventCallback:function(a){return F=a}}},I=function(b){function d(b){b=g.indexOf(b);-1<b&&g.splice(b,2)}function f(){for(var b=1;b<g.length;b+=2)g[b]()}b=P(b);b.setEventCallback(function(b){!1===b.redraw?b.redraw=void 0:f()});var g=[];return{subscribe:function(b,f){d(b);g.push(b,R(f))},unsubscribe:d,redraw:f,render:b.render}}(window);L.setCompletionCallback(I.redraw);D.mount=function(b){return function(d,
f){if(null===f)b.render(d,[]),b.unsubscribe(d);else{if(null==f.view&&"function"!==typeof f)throw Error("m.mount(element, component) expects a component, not a vnode");b.subscribe(d,function(){b.render(d,B(f))});b.redraw()}}}(I);var U=x,M=function(b){if(""===b||null==b)return{};"?"===b.charAt(0)&&(b=b.slice(1));b=b.split("&");for(var d={},f={},g=0;g<b.length;g++){var e=b[g].split("="),n=decodeURIComponent(e[0]);e=2===e.length?decodeURIComponent(e[1]):"";"true"===e?e=!0:"false"===e&&(e=!1);var h=n.split(/\]\[?|\[/),
q=d;-1<n.indexOf("[")&&h.pop();for(var m=0;m<h.length;m++){n=h[m];var k=h[m+1];k=""==k||!isNaN(parseInt(k,10));var t=m===h.length-1;""===n&&(n=h.slice(0,m).join(),null==f[n]&&(f[n]=0),n=f[n]++);null==q[n]&&(q[n]=t?e:k?[]:{});q=q[n]}}return d},V=function(b){function d(d){var e=b.location[d].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===d&&"/"!==e[0]&&(e="/"+e);return e}function f(b){return function(){null==h&&(h=n(function(){h=null;b()}))}}function g(b,d,e){var a=b.indexOf("?"),
f=b.indexOf("#"),g=-1<a?a:-1<f?f:b.length;if(-1<a){a=M(b.slice(a+1,-1<f?f:b.length));for(var h in a)d[h]=a[h]}if(-1<f)for(h in d=M(b.slice(f+1)),d)e[h]=d[h];return b.slice(0,g)}var e="function"===typeof b.history.pushState,n="function"===typeof setImmediate?setImmediate:setTimeout,h,q={prefix:"#!",getPath:function(){switch(q.prefix.charAt(0)){case "#":return d("hash").slice(q.prefix.length);case "?":return d("search").slice(q.prefix.length)+d("hash");default:return d("pathname").slice(q.prefix.length)+
d("search")+d("hash")}},setPath:function(d,f,h){var a={},k={};d=g(d,a,k);if(null!=f){for(var m in f)a[m]=f[m];d=d.replace(/:([^\/]+)/g,function(b,d){delete a[d];return f[d]})}(m=F(a))&&(d+="?"+m);(k=F(k))&&(d+="#"+k);e?(k=h?h.state:null,m=h?h.title:null,b.onpopstate(),h&&h.replace?b.history.replaceState(k,m,q.prefix+d):b.history.pushState(k,m,q.prefix+d)):b.location.href=q.prefix+d},defineRoutes:function(d,h,n){function a(){var a=q.getPath(),e={},f=g(a,e,e),k=b.history.state;if(null!=k)for(var m in k)e[m]=
k[m];for(var t in d)if(k=new RegExp("^"+t.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),k.test(f)){f.replace(k,function(){for(var b=t.match(/:[^\/]+/g)||[],f=[].slice.call(arguments,1,-2),g=0;g<b.length;g++)e[b[g].replace(/:|\./g,"")]=decodeURIComponent(f[g]);h(d[t],e,a,t)});return}n(a,e)}e?b.onpopstate=f(a):"#"===q.prefix.charAt(0)&&(b.onhashchange=a);a()}};return q};D.route=function(b,d){var f=V(b),g=function(b){return b},e,n,h,q,m,k=function(b,a,k){if(null==b)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");
var t=function(){null!=e&&d.render(b,e(B(n,h.key,h)))},w=function(b){if(b!==a)f.setPath(a,null,{replace:!0});else throw Error("Could not resolve default route "+a);};f.defineRoutes(k,function(a,b,d){var f=m=function(a,k){f===m&&(n=null==k||"function"!==typeof k.view&&"function"!==typeof k?"div":k,h=b,q=d,m=null,e=(a.render||g).bind(a),t())};a.view||"function"===typeof a?f({},a):a.onmatch?U.resolve(a.onmatch(b,d)).then(function(b){f(a,b)},w):f(a,"div")},w);d.subscribe(b,t)};k.set=function(b,a,d){null!=
m&&(d=d||{},d.replace=!0);m=null;f.setPath(b,a,d)};k.get=function(){return q};k.prefix=function(b){f.prefix=b};k.link=function(b){b.dom.setAttribute("href",f.prefix+b.attrs.href);b.dom.onclick=function(a){a.ctrlKey||a.metaKey||a.shiftKey||2===a.which||(a.preventDefault(),a.redraw=!1,a=this.getAttribute("href"),0===a.indexOf(f.prefix)&&(a=a.slice(f.prefix.length)),k.set(a,void 0,void 0))}};k.param=function(b){return"undefined"!==typeof h&&"undefined"!==typeof b?h[b]:h};return k}(window,I);D.withAttr=
function(b,d,f){return function(g){d.call(f||this,b in g.currentTarget?g.currentTarget[b]:g.currentTarget.getAttribute(b))}};var W=P(window);D.render=W.render;D.redraw=I.redraw;D.request=L.request;D.jsonp=L.jsonp;D.parseQueryString=M;D.buildQueryString=F;D.version="1.1.6";D.vnode=B;"undefined"!==typeof module?module.exports=D:window.m=D})();

@@ -1,5 +0,7 @@

/* eslint-disable no-bitwise, no-process-exit */
/* eslint-disable global-require, no-bitwise, no-process-exit */
"use strict"
module.exports = new function init(name) {
;(function(m) {
if (typeof module !== "undefined") module["exports"] = m()
else window.o = m()
})(function init(name) {
var spec = {}, subjects = [], results, only = null, ctx = spec, start, stack = 0, nextTickish, hasProcess = typeof process === "object", hasOwn = ({}).hasOwnProperty

@@ -9,2 +11,5 @@

try {throw new Error} catch (e) {
var ospecFileName = e.stack && (/[\/\\](.*?):\d+:\d+/).test(e.stack) ? e.stack.match(/[\/\\](.*?):\d+:\d+/)[1] : null
}
function o(subject, predicate) {

@@ -53,6 +58,31 @@ if (predicate === undefined) {

}
o.run = function() {
o.cleanStackTrace = function(error) {
// For IE 10+ in quirks mode, and IE 9- in any mode, errors don't have a stack
if (error.stack == null) return ""
var i = 0, header = error.message ? error.name + ": " + error.message : error.name, stack
// some environments add the name and message to the stack trace
if (error.stack.indexOf(header) === 0) {
stack = error.stack.slice(header.length).split(/\r?\n/)
stack.shift() // drop the initial empty string
} else {
stack = error.stack.split(/\r?\n/)
}
if (ospecFileName == null) return stack.join("\n")
// skip ospec-related entries on the stack
while (stack[i].indexOf(ospecFileName) !== -1) i++
// now we're in user code
return stack[i]
}
o.run = function(reporter) {
results = []
start = new Date
test(spec, [], [], report)
test(spec, [], [], function() {
setTimeout(function () {
if (typeof reporter === "function") reporter(results)
else {
var errCount = o.report(results)
if (hasProcess && errCount !== 0) process.exit(1)
}
})
})

@@ -89,5 +119,31 @@ function test(spec, pre, post, finalize) {

var fn = fns[cursor++]
var timeout = 0, delay = 200, s = new Date
var isDone = false
function done(err) {
if (err) {
if (err.message) record(err.message, err)
else record(err)
subjects.pop()
next()
}
if (timeout !== undefined) {
timeout = clearTimeout(timeout)
if (delay !== Infinity) record(null)
if (!isDone) next()
else throw new Error("`" + arg + "()` should only be called once")
isDone = true
}
else console.log("# elapsed: " + Math.round(new Date - s) + "ms, expected under " + delay + "ms")
}
function startTimer() {
timeout = setTimeout(function() {
timeout = undefined
record("async test timed out")
next()
}, Math.min(delay, 2147483647))
}
if (fn.length > 0) {
var timeout = 0, delay = 200, s = new Date
var isDone = false
var body = fn.toString()

@@ -97,29 +153,19 @@ var arg = (body.match(/\(([\w$]+)/) || body.match(/([\w$]+)\s*=>/) || []).pop()

try {
fn(function done() {
if (timeout !== undefined) {
timeout = clearTimeout(timeout)
if (delay !== Infinity) record(null)
if (!isDone) next()
else throw new Error("`" + arg + "()` should only be called once")
isDone = true
}
else console.log("# elapsed: " + Math.round(new Date - s) + "ms, expected under " + delay + "ms")
}, function(t) {delay = t})
fn(done, function(t) {delay = t})
}
catch (e) {
record(e.message, e)
subjects.pop()
next()
done(e)
}
if (timeout === 0) {
timeout = setTimeout(function() {
timeout = undefined
record("async test timed out")
next()
}, Math.min(delay, 2147483647))
startTimer()
}
}
else {
fn()
nextTickish(next)
var p = fn()
if (p && p.then) {
startTimer()
p.then(function() { done() }, done)
} else {
nextTickish(next)
}
}

@@ -208,3 +254,4 @@ }

result.message = message
result.error = error.stack
result.error = error
}

@@ -214,2 +261,3 @@ results.push(result)

function serialize(value) {
if (hasProcess) return require("util").inspect(value)
if (value === null || (typeof value === "object" && !(value instanceof Array)) || typeof value === "number") return String(value)

@@ -223,9 +271,9 @@ else if (typeof value === "function") return value.name || "<anonymous function>"

function report() {
var status = 0
o.report = function (results) {
var errCount = 0
for (var i = 0, r; r = results[i]; i++) {
if (!r.pass) {
var stackTrace = r.error.match(/^(?:(?!Error|[\/\\]ospec[\/\\]ospec\.js).)*$/m)
var stackTrace = o.cleanStackTrace(r.error)
console.error(r.context + ":\n" + highlight(r.message) + (stackTrace ? "\n\n" + stackTrace + "\n\n" : ""), hasProcess ? "" : "color:red", hasProcess ? "" : "color:black")
status = 1
errCount++
}

@@ -238,6 +286,6 @@ }

)
if (hasProcess && status === 1) process.exit(1)
return errCount
}
if(hasProcess) {
if (hasProcess) {
nextTickish = process.nextTick

@@ -252,2 +300,2 @@ } else {

return o
}
})
{
"name": "ospec",
"version": "1.3.1",
"version": "1.4.0",
"description": "Noiseless testing framework",

@@ -5,0 +5,0 @@ "main": "ospec.js",

@@ -10,3 +10,3 @@ ospec [![NPM Version](https://img.shields.io/npm/v/ospec.svg)](https://www.npmjs.com/package/ospec) [![NPM License](https://img.shields.io/npm/l/ospec.svg)](https://www.npmjs.com/package/ospec)

- ~180 LOC
- ~330 LOC including the CLI runner
- terser and faster test code than with mocha, jasmine or tape

@@ -23,3 +23,3 @@ - test code reads like bullet points

- async tests and hooks
- explicitly disallows test-space configuration to encourage focus on testing, and to provide uniform test suites across projects
- explicitly regulates test-space configuration to encourage focus on testing, and to provide uniform test suites across projects

@@ -153,2 +153,18 @@ ## Usage

Alternativly you can return a promise or even use an async function in tests:
```javascript
o("promise test", function() {
return new Promise(function(resolve) {
setTimeout(resolve, 10)
})
})
```
```javascript
o("promise test", async function() {
await someOtherAsyncFunction()
})
```
By default, asynchronous tests time out after 20ms. This can be changed on a per-test basis using the `timeout` argument:

@@ -164,4 +180,19 @@

Note that the `timeout` function call must be the first statement in its test.
Note that the `timeout` function call must be the first statement in its test. This currently does not work for promise tests. You can combine both methods to do this:
```javascript
o("promise test", function(done, timeout) {
timeout(1000)
someOtherAsyncFunctionThatTakes900ms().then(done)
})
```
```javascript
o("promise test", async function(done, timeout) {
timeout(1000)
await someOtherAsyncFunctionThatTakes900ms()
done()
})
```
Asynchronous tests generate an assertion that succeeds upon calling `done` or fails on timeout with the error message `async test timed out`.

@@ -287,4 +318,6 @@

To work around this limitation, you can use [`npm-run`](https://www.npmjs.com/package/npm-run) which enables one to run the binaries of locally installed packages.
If you're using a recent version of npm (v5+), you can use run `npx ospec` from your project folder.
Otherwise, to work around this limitation, you can use [`npm-run`](https://www.npmjs.com/package/npm-run) which enables one to run the binaries of locally installed packages.
```

@@ -414,8 +447,23 @@ npm install npm-run -g

### void o.run()
### void o.run([Function reporter])
Runs the test suite
Runs the test suite. By default passing test results are printed using
`console.log` and failing test results are printed using `console.error`.
If you have custom continuous integration needs then you can use a
reporter to process [test result data](#result-data) yourself.
If running in Node.js, ospec will call `process.exit` after reporting
results by default. If you specify a reporter, ospec will not do this
and allow your reporter to respond to results in its own way.
---
### Number o.report(results)
The default reporter used by `o.run()` when none are provided. Returns the number of failures, doesn't exit Node.js by itself. It expects an array of [test result data](#result-data) as argument.
---
### Function o.new()

@@ -435,2 +483,70 @@

## Result data
Test results are available by reference for integration purposes. You
can use custom reporters in `o.run()` to process these results.
```javascript
o.run(function(results) {
// results is an array
results.forEach(function(result) {
// ...
})
})
```
---
### Boolean result.pass
True if the test passed. **No other keys will exist on the result if this value is true.**
---
### Error result.error
The `Error` object explaining the reason behind a failure.
---
### String result.message
If an exception was thrown inside the corresponding test, this will equal that Error's `message`. Otherwise, this will be a preformatted message in [SVO form](https://en.wikipedia.org/wiki/Subject%E2%80%93verb%E2%80%93object). More specifically, `${subject}\n${verb}\n${object}`.
As an example, the following test's result message will be `"false\nshould equal\ntrue"`.
```javascript
o.spec("message", function() {
o(false).equals(true)
})
```
If you specify an assertion description, that description will appear two lines above the subject.
```javascript
o.spec("message", function() {
o(false).equals(true)("Candyland") // result.message === "Candyland\n\nfalse\nshould equal\ntrue"
})
```
---
### String result.context
A `>`-separated string showing the structure of the test specification.
In the below example, `result.context` would be `testing > rocks`.
```javascript
o.spec("testing", function() {
o.spec("rocks", function() {
o(false).equals(true)
})
})
```
---
## Goals

@@ -441,4 +557,4 @@

- Disallow ability to pick between API styles (BDD/TDD/Qunit, assert/should/expect, etc)
- Disallow ability to pick between different reporters
- Disallow ability to add custom assertion types
- Provide a default simple reporter
- Make assertion code terse, readable and self-descriptive

@@ -445,0 +561,0 @@ - Have as few assertion types as possible for a workable usage pattern

@@ -21,2 +21,73 @@ "use strict"

new function(o) {
var clone = o.new()
clone.spec("clone", function() {
clone("fail", function() {
clone(true).equals(false)
})
clone("pass", function() {
clone(true).equals(true)
})
})
// Predicate test passing on clone results
o.spec("reporting", function() {
o("reports per instance", function(done, timeout) {
timeout(100) // Waiting on clone
clone.run(function(results) {
o(typeof results).equals("object")
o("length" in results).equals(true)
o(results.length).equals(2)("Two results")
o("error" in results[0] && "pass" in results[0]).equals(true)("error and pass keys present in failing result")
o(!("error" in results[1]) && "pass" in results[1]).equals(true)("only pass key present in passing result")
o(results[0].pass).equals(false)("Test meant to fail has failed")
o(results[1].pass).equals(true)("Test meant to pass has passed")
done()
})
})
o("o.report() returns the number of failures", function () {
var log = console.log, error = console.error
console.log = o.spy()
console.error = o.spy()
function makeError(msg) {try{throw msg ? new Error(msg) : new Error} catch(e){return e}}
try {
var errCount = o.report([{pass: true}, {pass: true}])
o(errCount).equals(0)
o(console.log.callCount).equals(1)
o(console.error.callCount).equals(0)
errCount = o.report([
{pass: false, error: makeError("hey"), message: "hey"}
])
o(errCount).equals(1)
o(console.log.callCount).equals(2)
o(console.error.callCount).equals(1)
errCount = o.report([
{pass: false, error: makeError("hey"), message: "hey"},
{pass: true},
{pass: false, error: makeError("ho"), message: "ho"}
])
o(errCount).equals(2)
o(console.log.callCount).equals(3)
o(console.error.callCount).equals(3)
} catch (e) {
o(1).equals(0)("Error while testing the reporter")
}
console.log = log
console.error = error
})
})
}(o)
o.spec("ospec", function() {

@@ -111,3 +182,3 @@ o.spec("sync", function() {

})
o.spec("async", function() {
o.spec("async callback", function() {
var a = 0, b = 0

@@ -153,2 +224,61 @@

})
o.spec("stack trace cleaner", function() {
o("handles line breaks", function() {
try {
throw new Error("line\nbreak")
} catch(error) {
var trace = o.cleanStackTrace(error)
o(trace).notEquals("break")
o(trace.includes("test-ospec.js")).equals(true)
}
})
})
o.spec("async promise", function() {
var a = 0, b = 0
function wrapPromise(fn) {
return new Promise((resolve, reject) => {
callAsync(() => {
try {
fn()
resolve()
} catch(e) {
reject(e)
}
})
})
}
o.before(function() {
return wrapPromise(() => {
a = 1
})
})
o.after(function() {
return wrapPromise(function() {
a = 0
})
})
o.beforeEach(function() {
return wrapPromise(function() {
b = 1
})
})
o.afterEach(function() {
return wrapPromise(function() {
b = 0
})
})
o("promise functions", function() {
return wrapPromise(function() {
o(a).equals(b)
o(a).equals(1)("a and b should be initialized")
})
})
})
})
{
"name": "mithril",
"version": "1.1.5",
"version": "1.1.6",
"description": "A framework for building brilliant applications",

@@ -5,0 +5,0 @@ "author": "Leo Horie",

@@ -134,3 +134,3 @@ "use strict"

promise.then(null, done)
promise.then(null, function() { done() })
})

@@ -137,0 +137,0 @@ o("non-function onFulfilled is ignored", function(done) {

@@ -9,2 +9,7 @@ "use strict"

function isEmpty(object) {
for (var key in object) if (hasOwn.call(object, key)) return false
return true
}
function compileSelector(selector) {

@@ -32,2 +37,14 @@ var match, tag = "div", classes = [], attrs = {}

if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
var newAttrs = {}
for(var key in attrs) {
if (hasOwn.call(attrs, key)) {
newAttrs[key] = attrs[key]
}
}
attrs = newAttrs
}
for (var key in state.attrs) {

@@ -34,0 +51,0 @@ if (hasOwn.call(state.attrs, key)) {

@@ -454,5 +454,6 @@ "use strict"

if (vnode.attrs && typeof vnode.attrs.onremove === "function") vnode.attrs.onremove.call(vnode.state, vnode)
if (typeof vnode.tag !== "string" && typeof vnode._state.onremove === "function") vnode._state.onremove.call(vnode.state, vnode)
if (vnode.instance != null) onremove(vnode.instance)
else {
if (typeof vnode.tag !== "string") {
if (typeof vnode._state.onremove === "function") vnode._state.onremove.call(vnode.state, vnode)
if (vnode.instance != null) onremove(vnode.instance)
} else {
var children = vnode.children

@@ -625,5 +626,5 @@ if (Array.isArray(children)) {

dom.vnodes = vnodes
for (var i = 0; i < hooks.length; i++) hooks[i]()
// document.activeElement can return null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement
if (active != null && $doc.activeElement !== active) active.focus()
for (var i = 0; i < hooks.length; i++) hooks[i]()
}

@@ -630,0 +631,0 @@

@@ -510,2 +510,19 @@ "use strict"

})
o("handles shared attrs", function() {
var attrs = {a: "b"}
var nodeA = m(".a", attrs)
var nodeB = m(".b", attrs)
o(nodeA.attrs.className).equals("a")
o(nodeA.attrs.a).equals("b")
o(nodeB.attrs.className).equals("b")
o(nodeB.attrs.a).equals("b")
})
o("doesnt modify passed attributes object", function() {
var attrs = {a: "b"}
m(".a", attrs)
o(attrs).deepEquals({a: "b"})
})
o("handles fragment children without attr unwrapped", function() {

@@ -512,0 +529,0 @@ var vnode = m("div", [m("i")], [m("s")])

@@ -33,2 +33,12 @@ "use strict"

o("maintains focus when changed manually in hook", function() {
var input = {tag: "input", attrs: {oncreate: function() {
input.dom.focus();
}}};
render(root, [input])
o($window.document.activeElement).equals(input.dom)
})
o("syncs input value if DOM value differs from vdom value", function() {

@@ -35,0 +45,0 @@ var input = {tag: "input", attrs: {value: "aaa", oninput: function() {}}}

@@ -92,2 +92,3 @@ "use strict"

o(vnode.dom.attributes["onremove"]).equals(undefined)
o(vnode.events).equals(undefined)
})

@@ -154,4 +155,44 @@ o("calls onremove on recycle", function() {

})
o("doesn't call onremove on children when the corresponding view returns null (after removing the parent)", function() {
var threw = false
var spy = o.spy()
var parent = createComponent({
view: function() {}
})
var child = createComponent({
view: function() {},
onremove: spy
})
render(root, {tag: parent, children: [child]})
try {
render(root, null)
} catch (e) {
threw = e
}
o(spy.callCount).equals(0)
o(threw).equals(false)
})
o("doesn't call onremove on children when the corresponding view returns null (after removing the children)", function() {
var threw = false
var spy = o.spy()
var parent = createComponent({
view: function() {}
})
var child = createComponent({
view: function() {},
onremove: spy
})
render(root, {tag: parent, children: [child]})
try {
render(root, {tag: parent})
} catch (e) {
threw = true
}
o(spy.callCount).equals(0)
o(threw).equals(false)
})
})
})
})

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