1.5.0
◀Back | Minified | Changelog | Cautionlog2016-07-11
After a major hiatus, Sugar 2.0.0 is nearly ready to be released. However, v2 introduces many breaking changes, so 1.5.0 is being released in the interim for those who aren't able to upgrade. This will be the last minor release of v1, however support of bugfixes in v1 will continue. Note that the documentation for 1.5.0 will still be available on this site, however other things like custom builds are 2.0.0 only.
New Methods
Number.isNaNshim.Object.isArguments.Date#getallows date creation with a context date that can be used as a starting point for relative dates.Function#memoizeallows memoization of expensive functions and is more robust thanFunction#once.
New Features
- Added ability for
String#stripTagsandStrip#removeTagsto pass a callback. - Added a third argument to
Number#bytesto allow normal SI units. - Added ability to pass a single string to
Date.range, for exampleDate.range('monday to thursday'). - Allow
String#eachto break the loop withfalse. - Updated
Array#sortByto handle sorting on multiple properties. - Fixed
String#unescapeHTMLto handle HTML (and hex) codes, as well as  - Set a global thousands and decimal marker with
Number.thousandsandNumber.decimal.
Bugfixes
- Fixed issue with the digit
tenin date creation. - Fixed issue with the
Date#[unit]Sinceimproperly applying error margins. - Fixed issue with dates shifting in "monthsFromNow" (and consequently "relative") when traversing into a month that doesn't have enough days.
- Fixed issue with advance/rewind using an object with both a "week" and "day" parameter.
- Fixed issue
Function#everynot being able to cancel itself. - Fixed issue with German dates not allowing abbreviated weekdays with 2 characters.
- Date.create(null) is now interpeted as a time stamp.
- Fix for ambiguous years not working with
Date#past/future. - Fix for odd iOS7 bug with
Number#abs(#400) - Fixed many issues with DST and simplified month traversal.
- Refactored the
sinceandfromNowmethods to traverse using internal date methods instead of applying an error margin. This makes them much more accurate during DST traversal, leap years, etc.
Other
- Moved
Object.map,Object.each, andObject.sizeto the object package. If you were using custom builds previously be aware of this.