Skip to content

Releases: andrewplummer/Sugar

2.0.2

05 Nov 05:43
Compare
Choose a tag to compare

2.0.0

05 Nov 05:33
Compare
Choose a tag to compare

1.5.0

05 Nov 05:33
Compare
Choose a tag to compare

1.4.1

14 Sep 08:44
Compare
Choose a tag to compare

v1.3.9 - jQuery 1.9 Fix and Object.toQueryString

20 Jun 21:57
Compare
Choose a tag to compare

The most major point of this release was fixing jQuery 1.9, which broke in one area when Sugar was included in the page. The cause was complex, on jQuery’s side there was an issue that I submitted a pull request for, however the most direct culprit was String#namespace which is a method that never really fit into the library anyway. As a result I have removed this method from String entirely. At the moment I’m not sure if it will be re-added as it feels better for another lib.

Object.toQueryString

The inverse to Object.fromQueryString, this method will take an object and turn it into a query string for use in a url. In addition to the main method it is also mapped onto extended objects, making it even easier. Finally, a namespace can be added to scope all parameters by the given namespace.

var o1 = { foo: 'bar' };
var o2 = { foo: [1,2,3] };
Object.toQueryString(o1)        // 'foo=bar'
Object.toQueryString(o2)        // 'foo[0]=1&foo[1]=2&foo[2]=3'
Object.toQueryString(o2, 'bar') // 'bar[foo][0]=1&bar[foo][1]=2&foo[2]=3'

var o1 = Object.extended({ foo: 'bar' });
var o2 = Object.extended({ foo: [1,2,3] });

o1.toQueryString()      // 'foo=bar'
o2.toQueryString()      // 'foo[0]=1&foo[1]=2&foo[2]=3'
o2.toQueryString('bar') // 'bar[foo][0]=1&bar[foo][1]=2&foo[2]=3'

Other Minor Fixes

Fixed issue with timezone offsets like “-0330”.
Fixed issue with date comparison methods like isToday not working when another locale is set.