uri-templates 0.4 javascript implementation feedback

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

uri-templates 0.4 javascript implementation feedback

Marc Portier-2
Hi all,

Finally got round at this javascript implementation of

(minus the partial syntax and some more testing)

Anyway, it is open at:

It wraps inside JQuery and comes with tests up in QUnit.
(JQuery dependency currently limited to the handy $.extend and $.isFunction)

Must say getting my head around things asked more time then I initially
expected: clarity and elegance of the syntax and explanation did hide
quite some more special cases then I would of have thought of.

One case I still haven't ironed out, to the extend I'm liking my
solution more :) is this:

> tested pattern: {;list}
> Expected: ";val1,val2,val3"
> Result:  ";list=val1,val2,val3"
> tested pattern: {;keys}
> Expected: ";key1,val1,key2,val2"
> Result:  ";keys=key1,val1,key2,val2"

which in my mind (and implementation) follows more closely the line of
thinking in:

> tested pattern: {?list}
> Expected: "?list=val1,val2,val3"
> tested pattern: {?keys}
> Expected: "?keys=key1,val1,key2,val2"

the consistency I see is this: both ; and ? operators deal with named
parameters, in unexploded form the values are wrapped up in one string,
but still expect value.

best regards,

PS: The link to the promised js implementation from
http://code.google.com/p/uri-templates/wiki/Implementations points to
some reserved space at www.snellspace.com  (I remember grabbing a 0.3
implmentation from James' blog way back, that is somewhat maintained
over here: )