Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix a bug where casting #map arguments as array was losing some items

  • Loading branch information...
commit d4962a69090521b34120bd9d55152c179f3962f2 1 parent f2c3dae
Arthur Corenzan authored
Showing with 9 additions and 6 deletions.
  1. +7 −4 way.js
  2. +2 −2 way.min.js
11 way.js
View
@@ -1,5 +1,5 @@
/*
- * WayJS v0.3.3 2012-09-05 23:14:53 -0300
+ * WayJS v0.3.4 2012-09-06 13:05:00 -0300
* by Arthur Corenzan <arthur@corenzan.com>
* licensed under http://creativecommons.org/licenses/by/3.0
* more on http://haggen.github.com/wayjs
@@ -17,11 +17,14 @@
Way.prototype = {
map: function() {
- var route = {};
+ var args, route;
+
+ args = [].slice.apply(arguments);
+ route = {};
route.params = [];
- route.pattern = this.translate([].shift.apply(arguments), route);
- route.actions = [].slice.apply(arguments);
+ route.pattern = this.translate(args.shift(), route);
+ route.actions = args;
this.routes.push(route);
},
4 way.min.js
View
@@ -1,7 +1,7 @@
/*
- * WayJS v0.3.3 2012-09-05 23:14:53 -0300
+ * WayJS v0.3.4 2012-09-06 13:05:00 -0300
* by Arthur Corenzan <arthur@corenzan.com>
* licensed under http://creativecommons.org/licenses/by/3.0
* more on http://haggen.github.com/wayjs
*/
-(function(e){"use strict";var t;t=function(){this.routes=[]},t.prototype={map:function(){var e={};e.params=[],e.pattern=this.translate([].shift.apply(arguments),e),e.actions=[].slice.apply(arguments),this.routes.push(e)},translate:function(e,t){var n;return n=e.replace(/\//g,"\\/"),n=n.replace(/\)/g,function(){return")?"}),n=n.replace(/:(\w[\w\d]*)|\(/g,function(e,n){return t.params.push(e==="("?"_":n),e==="("?"(":"([^\\/]+?)"}),n=n.replace(/\*/g,function(){return t.params.push("splat"),"(.+?)"}),new RegExp("^"+n+"$")},match:function(e){var t,n,r,i,s,o;for(s=0;s<this.routes.length;s++){t=this.routes[s],n={actions:t.actions,params:{}},i=e.match(t.pattern);if(i){for(o=1;o<i.length;o++)r=t.params[o-1],r==="splat"?"splat"in n.params?n.params.splat.push(i[o]):n.params.splat=[i[o]]:n.params[r]=i[o];return n}}}},typeof window=="object"?typeof window.define=="function"&&"amd"in window.define?window.define("way",function(){return new t}):window.way=new t:typeof module=="object"&&"exports"in module&&(module.exports=new t)})();
+(function(e){"use strict";var t;t=function(){this.routes=[]},t.prototype={map:function(){var e,t;e=[].slice.apply(arguments),t={},t.params=[],t.pattern=this.translate(e.shift(),t),t.actions=e,this.routes.push(t)},translate:function(e,t){var n;return n=e.replace(/\//g,"\\/"),n=n.replace(/\)/g,function(){return")?"}),n=n.replace(/:(\w[\w\d]*)|\(/g,function(e,n){return t.params.push(e==="("?"_":n),e==="("?"(":"([^\\/]+?)"}),n=n.replace(/\*/g,function(){return t.params.push("splat"),"(.+?)"}),new RegExp("^"+n+"$")},match:function(e){var t,n,r,i,s,o;for(s=0;s<this.routes.length;s++){t=this.routes[s],n={actions:t.actions,params:{}},i=e.match(t.pattern);if(i){for(o=1;o<i.length;o++)r=t.params[o-1],r==="splat"?"splat"in n.params?n.params.splat.push(i[o]):n.params.splat=[i[o]]:n.params[r]=i[o];return n}}}},typeof window=="object"?typeof window.define=="function"&&"amd"in window.define?window.define("way",function(){return new t}):window.way=new t:typeof module=="object"&&"exports"in module&&(module.exports=new t)})();
Please sign in to comment.
Something went wrong with that request. Please try again.