Skip to content

Commit

Permalink
Rebuild dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarber623 committed Jun 16, 2022
1 parent b11b0ec commit 59e50d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 3 additions & 4 deletions dist/routerrouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
*
* RouterRouter may be freely distributed under the MIT license.
*/

(function(global, factory) {
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = global || self,
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
global.RouterRouter = factory());
})(this, (function() {
"use strict";
const extractParameters = (route, pathname) => route.exec(pathname).slice(1).map(parameter => parameter ? decodeURIComponent(parameter) : null);
const extractParameters = (route, pathname) => route.exec(pathname).slice(1).map((parameter => parameter ? decodeURIComponent(parameter) : null));
const routeToRegExp = route => {
route = route.replace(/[$.|]+?/g, "\\$&").replace(/\((.+?)\)/g, "(?:$1)?").replace(/:\w+/g, "([^/]+)").replace(/\*(\w+)?/g, "(.+?)");
return new RegExp(`^${route}$`);
Expand All @@ -26,7 +25,7 @@
this.location = window.location;
const routes = this.options.routes;
if (routes) {
Object.keys(routes).forEach(route => this.route(route, routes[route]));
Object.keys(routes).forEach((route => this.route(route, routes[route])));
}
}
route(route, action) {
Expand Down
3 changes: 1 addition & 2 deletions dist/routerrouter.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
*
* RouterRouter may be freely distributed under the MIT license.
*/

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RouterRouter=t()}(this,(function(){"use strict";return class{constructor(e={}){this.options=e,this.location=window.location;const t=this.options.routes;t&&Object.keys(t).forEach(e=>this.route(e,t[e]))}route(e,t){const o=decodeURIComponent(this.location.pathname);e instanceof RegExp||(e=(e=>(e=e.replace(/[$.|]+?/g,"\\$&").replace(/\((.+?)\)/g,"(?:$1)?").replace(/:\w+/g,"([^/]+)").replace(/\*(\w+)?/g,"(.+?)"),new RegExp(`^${e}$`)))(e)),"string"==typeof t&&(t=this.options[t]),e.test(o)&&"function"==typeof t&&t.apply(this,((e,t)=>e.exec(t).slice(1).map(e=>e?decodeURIComponent(e):null))(e,o))}}}));
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).RouterRouter=o()}(this,(function(){"use strict";return class{constructor(e={}){this.options=e,this.location=window.location;const o=this.options.routes;o&&Object.keys(o).forEach((e=>this.route(e,o[e])))}route(e,o){const t=decodeURIComponent(this.location.pathname);e instanceof RegExp||(e=(e=>(e=e.replace(/[$.|]+?/g,"\\$&").replace(/\((.+?)\)/g,"(?:$1)?").replace(/:\w+/g,"([^/]+)").replace(/\*(\w+)?/g,"(.+?)"),new RegExp(`^${e}$`)))(e)),"string"==typeof o&&(o=this.options[o]),e.test(t)&&"function"==typeof o&&o.apply(this,((e,o)=>e.exec(o).slice(1).map((e=>e?decodeURIComponent(e):null)))(e,t))}}}));
7 changes: 3 additions & 4 deletions dist/routerrouter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
*
* RouterRouter may be freely distributed under the MIT license.
*/

const extractParameters = (route, pathname) => route.exec(pathname).slice(1).map(parameter => parameter ? decodeURIComponent(parameter) : null);
const extractParameters = (route, pathname) => route.exec(pathname).slice(1).map((parameter => parameter ? decodeURIComponent(parameter) : null));

const routeToRegExp = route => {
route = route.replace(/[$.|]+?/g, "\\$&").replace(/\((.+?)\)/g, "(?:$1)?").replace(/:\w+/g, "([^/]+)").replace(/\*(\w+)?/g, "(.+?)");
Expand All @@ -23,7 +22,7 @@ class RouterRouter {
this.location = window.location;
const routes = this.options.routes;
if (routes) {
Object.keys(routes).forEach(route => this.route(route, routes[route]));
Object.keys(routes).forEach((route => this.route(route, routes[route])));
}
}
route(route, action) {
Expand All @@ -40,4 +39,4 @@ class RouterRouter {
}
}

export default RouterRouter;
export { RouterRouter as default };

0 comments on commit 59e50d5

Please sign in to comment.