From c8bd044790d65ac4673248cab23bfb47f8cf56be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20J=C3=BCrgens?= Date: Wed, 26 Dec 2012 14:14:48 -0300 Subject: [PATCH 1/2] Patch for supporting passing numbers as strings. For example 0001 is treated as string instead of 1. Also added seccond parameter to parseInt for setting base 10 for convertions instead of octal. --- lib/journey.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/journey.js b/lib/journey.js index f41c9fa..9936a80 100644 --- a/lib/journey.js +++ b/lib/journey.js @@ -248,7 +248,7 @@ journey.Router.prototype = { args.push(res); args.push.apply(args, match.slice(1).map(function (m) { - return /^\d+$/.test(m) ? parseInt(m) : m; + return /^[^0]\d+$/.test(m) ? parseInt(m,10) : m; })); args.push(params); return route.handler.apply(this, args); From d3746422c587a8ade452f3075779855331710817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20J=C3=BCrgens?= Date: Thu, 7 Feb 2013 19:30:20 -0300 Subject: [PATCH 2/2] Bugfix for detect numeric params in rest --- lib/journey.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/journey.js b/lib/journey.js index 9936a80..17ab50d 100644 --- a/lib/journey.js +++ b/lib/journey.js @@ -248,7 +248,7 @@ journey.Router.prototype = { args.push(res); args.push.apply(args, match.slice(1).map(function (m) { - return /^[^0]\d+$/.test(m) ? parseInt(m,10) : m; + return /^[1-9]+\d*$/.test(m) ? parseInt(m,10) : m; })); args.push(params); return route.handler.apply(this, args);