[Pkg-javascript-commits] [backbone] 55/74: first draft of splatted params.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:59:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.3.0
in repository backbone.

commit 37cd99124dd334123df67b183b016f5ff6b9fff7
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Mon Nov 8 13:45:08 2010 -0500

    first draft of splatted params.
---
 backbone.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/backbone.js b/backbone.js
index 123a38b..82550f6 100644
--- a/backbone.js
+++ b/backbone.js
@@ -574,7 +574,7 @@
   };
 
   var namedParam = /:([\w\d]+)/g;
-  var paramMatch = "([^\/]+)";
+  var splatParam = /\*([\w\d]+)/g;
 
   // Set up all inheritable **Backbone.Controller** properties and methods.
   _.extend(Backbone.Controller.prototype, Backbone.Events, {
@@ -603,7 +603,8 @@
     },
 
     _routeToRegExp : function(route) {
-      return new RegExp('^#' + route.replace(namedParam, paramMatch) + '$');
+      route = route.replace(namedParam, "([^\/]*)").replace(splatParam, "(.*?)");
+      return new RegExp('^#' + route + '$');
     },
 
     _extractArguments : function(route, fragment) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list