js_routes 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,8 +18,11 @@
18
18
  $.each(paramsHash, function(name, value) {
19
19
  var pattern, replacement;
20
20
  if (path.match(new RegExp(":" + name))) {
21
- pattern = "(.*?)\\(?([\\.\\/]?):" + name + "(\\(.*?\\)|[^\\)]*)?(.*)";
21
+ pattern = "(.*?)\\(([\\.\\/\\w]*?):" + name + "(\\(.*?\\)|[^\\)]*)?\\)(.*)";
22
22
  replacement = "$1$2" + value + "$3$4";
23
+ path = path.replace(new RegExp(pattern), replacement);
24
+ pattern = "(.*?):" + name + "(.*)";
25
+ replacement = "$1" + value + "$2";
23
26
  return path = path.replace(new RegExp(pattern), replacement);
24
27
  } else {
25
28
  return extraParams[name] = value;
@@ -12,9 +12,13 @@ $.buildPath = (path, params...) ->
12
12
  # try to insert parameters
13
13
  $.each paramsHash, (name, value) ->
14
14
  if path.match(new RegExp(":#{name}"))
15
- pattern = "(.*?)\\(?([\\.\\/]?):#{name}(\\(.*?\\)|[^\\)]*)?\\)?(.*)"
15
+ pattern = "(.*?)\\(([\\.\\/\\w]*?):#{name}(\\(.*?\\)|[^\\)]*)?\\)(.*)"
16
16
  replacement = "$1$2#{value}$3$4"
17
17
  path = path.replace new RegExp(pattern), replacement
18
+
19
+ pattern = "(.*?):#{name}(.*)"
20
+ replacement = "$1#{value}$2"
21
+ path = path.replace new RegExp(pattern), replacement
18
22
  else extraParams[name] = value
19
23
 
20
24
  # cleanup
@@ -1,3 +1,3 @@
1
1
  module JsRoutes
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: