I only got halfway through routing.js, but wanted to share what I had
before I went into calls. No one should wait for me: please don't count
me for the two reviews today. However, I will return to this if I can.
https://codereview.appspot.com/7327045/diff/3001/app/assets/javascripts/routing.js#newcode7
app/assets/javascripts/routing.js:7: function _trim(s, char, leading,
trailing) {
I don't understand yet why this only trims a single character. My
suspicion is that, as I read, I'll understand that this is all you need,
and otherwise you would have been in the "oh my gosh JS doesn't have a
built-in regex excape function" place.
I only got halfway through routing.js, but wanted to share what I had
before I went into calls. No one should wait for me: please don't count
me for the two reviews today. However, I will return to this if I can.
Gary
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js javascripts/ routing. js (right):
File app/assets/
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode5 javascripts/ routing. js:5: // particuallary around text
app/assets/
copy and paste error: please update comment to describe what this
actually does (and the old comment has a typo, "particularly," but the
associated module has been removed from trunk).
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode7 javascripts/ routing. js:7: function _trim(s, char, leading,
app/assets/
trailing) {
I don't understand yet why this only trims a single character. My
suspicion is that, as I read, I'll understand that this is all you need,
and otherwise you would have been in the "oh my gosh JS doesn't have a
built-in regex excape function" place.
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode20 javascripts/ routing. js:20: function ltrim(s, char) { return
app/assets/
_trim(s, char, true, false); }
Wouldn't it be nice if the built-in trim were flexible enough for what
you need!
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode23 javascripts/ routing. js:23: function pairs(o) {
app/assets/
docstring would help with easy reading.
Return sorted array of object attribute pairs (name, value).
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode37 javascripts/ routing. js:37: // Multi dimensional router
app/assets/
(TARDIS).
lol
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode49 javascripts/ routing. js:49: return parts[0];
app/assets/
trivial, but when placed next to your getQS implementation, "return
url.split('?')[0];" looks pretty reasonable.
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode65 javascripts/ routing. js:65: var parts = this.fragment) ;
app/assets/
url.split(
Might be helpful to include examples in comments:
> '/foo/bar' .split( /\/?(:\ w+\:)/) bar'.split( /\/?(:\ w+\:)/)
["/foo/bar"]
'/> :baz:/foo/
["", ":baz:", "/foo/bar"]
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode67 javascripts/ routing. js:67: // This is a URL fragment w/o a
app/assets/
namespace
Took me a second to agree, but yes, nice.
https:/ /codereview. appspot. com/7327045/ diff/3001/ app/assets/ javascripts/ routing. js#newcode68 javascripts/ routing. js:68: result.charmstore = parts[0];
app/assets/
wait a second, that's not general-purpose! :-)
I don't see the need for this to be general purpose. I suggest moving
it into app/routing.js. Alternatively, if you really want to, clean
this up.
https:/ /codereview. appspot. com/7327045/