vanilla-ui-router
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.vanillaUIRouter=e.vanillaUIRouter||{})}(this,function(e){"use strict";var n=function(e){return isNaN(e)?"true"===e||"false"===e?JSON.parse(e):e:parseInt(e,10)},t=function(e,t){var o=t.split("/"),r=e.split("/");return r.map(function(e,n){if(e.indexOf(":",0)===-1)return null;var t={},r=e.substr(1,e.length-1);return t[r]=o[n],t}).filter(function(e){return null!==e}).reduce(function(e,t){return Object.keys(t).forEach(function(o){e[o]=n(t[o])}),e},{})},o=function(e,n){var t=e.split("/"),o=t[0];return n.filter(function(e){var n=e.split("/"),r=0===n.map(function(e,n){return e.indexOf(":",0)!==-1||e===t[n]}).reduce(function(e,n){return n===!1&&++e,e},0);return e.indexOf(o,0)!==-1&&r&&t.length===n.length})[0]},r=window.XMLHttpRequest,i=function(e,n){var t=new r;t.onreadystatechange=function(){4===t.readyState&&n(t.responseText)},t.open("GET",e),t.send()},a=function(e,n,t){if(e&&(e.templateString&&(n.innerHTML=e.templateString,t()),e.templateUrl&&i(e.templateUrl,function(e){n.innerHTML=e,t()}),e.templateId)){var o=document.getElementById(e.templateId);n.innerHTML=o.text,t()}},u=function(e){var n={},r=e.cloneNode(!0),i=null,u=function(e){window.location.hash=e},d=function(e){n["*"]=e},f=function e(t,o,r){return n[t]=o,n[t].data=r,{addRoute:e,otherwise:d,navigateTo:u}},c=function(){if(e.parentElement){var n=r.cloneNode(!0);e.parentElement.insertBefore(n,e),"undefined"==typeof e.remove?e.removeNode(!0):e.remove(),e=n}},l=function(){i&&"undefined"!=typeof i.dispose&&i.dispose(e)},s=function(){var r="*",u=location.hash.slice(1),d=o(u,Object.keys(n)),f={};d&&(f=t(d,u));var s=Object.keys(n).indexOf(d)>-1?n[d]:n[r];s&&(l(s),i=s,c(),"function"==typeof s?s(e,f,s.data):a(s,e,function(){"function"==typeof s.routeHandler&&s.routeHandler(e,f,s.data)}))};return window&&(window.removeEventListener("hashchange",s),window.addEventListener("hashchange",s),window.removeEventListener("load",s),window.addEventListener("load",s)),{addRoute:f,otherwise:d,navigateTo:u}};e.createRouter=u,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.vanillaUIRouter=e.vanillaUIRouter||{})}(this,function(e){"use strict";var t=function(e){return isNaN(e)?"true"===e||"false"===e?JSON.parse(e):e:parseInt(e,10)},n=function(e,n){var r=n.split("/");return e.split("/").map(function(e,t){if(-1===e.indexOf(":",0))return null;var n={};return n[e.substr(1,e.length-1)]=r[t],n}).filter(function(e){return null!==e}).reduce(function(e,n){return Object.keys(n).forEach(function(r){e[r]=t(n[r])}),e},{})},r=function(e,t){var n=e.split("/"),r=n[0];return t.filter(function(e){var t=e.split("/"),o=0===t.map(function(e,t){return-1!==e.indexOf(":",0)||e===n[t]}).reduce(function(e,t){return!1===t&&++e,e},0);return-1!==e.indexOf(r,0)&&o&&n.length===t.length})[0]},o=window.XMLHttpRequest,i=function(e,t){var n=new o;n.onreadystatechange=function(){4===n.readyState&&t(n.responseText)},n.open("GET",e),n.send()},a=function(e,t,n){if(e&&(e.templateString&&(t.innerHTML=e.templateString,n()),e.templateUrl&&i(e.templateUrl,function(e){t.innerHTML=e,n()}),e.templateId)){var r=document.getElementById(e.templateId);t.innerHTML=r.text,n()}};e.createRouter=function(e){var t={},o=e.cloneNode(!0),i=null,u=function(e){window.location.hash=e},f=function(e){t["*"]=e},d=function(){if(e.parentElement){var t=o.cloneNode(!0);e.parentElement.insertBefore(t,e),void 0===e.remove?e.removeNode(!0):e.remove(),e=t}},l=function(){i&&void 0!==i.dispose&&i.dispose(e)},c=function(){var o=location.hash.slice(1),u=r(o,Object.keys(t)),f={};u&&(f=n(u,o));var c=Object.keys(t).indexOf(u)>-1?t[u]:t["*"];if(c)if(l(),i=c,d(),"function"==typeof c)c(e,f,c.data);else{if(!c.templateString&&!c.templateId&&!c.templateUrl)throw Error("No template configured for route "+o);a(c,e,function(){"function"==typeof c.routeHandler&&c.routeHandler(e,f,c.data)})}};return window&&(window.removeEventListener("hashchange",c),window.addEventListener("hashchange",c),window.removeEventListener("load",c),window.addEventListener("load",c)),{addRoute:function e(n,r,o){return t[n]=r,t[n].data=o,{addRoute:e,otherwise:f,navigateTo:u}},otherwise:f,navigateTo:u}},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -167,2 +167,6 @@ 'use strict'; | ||
if (!routeHandler.templateString && !routeHandler.templateId && !routeHandler.templateUrl) { | ||
throw Error('No template configured for route ' + currentHash); | ||
} | ||
renderTemplates(routeHandler, domEntryPoint, function () { | ||
@@ -169,0 +173,0 @@ if (typeof routeHandler.routeHandler === 'function') { |
{ | ||
"name": "vanilla-ui-router", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Simple vanilla JavaScript router", | ||
@@ -22,3 +22,3 @@ "homepage": "https://github.com/micromata/vanilla-ui-router", | ||
"devDependencies": { | ||
"babel-jest": "^18.0.0", | ||
"babel-jest": "20.0.3", | ||
"babel-polyfill": "^6.16.0", | ||
@@ -28,12 +28,12 @@ "babel-preset-es2015": "^6.18.0", | ||
"coveralls": "^2.11.15", | ||
"eslint": "^3.11.1", | ||
"eslint-config-xo": "^0.17.0", | ||
"jest-cli": "^18.0.0", | ||
"rollup": "^0.38.0", | ||
"eslint": "^4.0.0", | ||
"eslint-config-xo": "0.18.2", | ||
"jest-cli": "20.0.4", | ||
"rollup": "^0.43.0", | ||
"rollup-plugin-babel": "^2.6.1", | ||
"rollup-plugin-commonjs": "^6.0.1", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"rollup-plugin-commonjs": "8.0.2", | ||
"rollup-plugin-node-resolve": "3.0.0", | ||
"rollup-plugin-sourcemaps": "^0.4.1", | ||
"rollup-plugin-uglify": "^1.0.1", | ||
"sinon": "^1.17.6" | ||
"rollup-plugin-uglify": "^2.0.1", | ||
"sinon": "2.3.4" | ||
}, | ||
@@ -40,0 +40,0 @@ "keywords": [ |
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
14467
161