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.isNaN
shim.Object.isArguments
.Date#get
allows date creation with a context date that can be used as a starting point for relative dates.Function#memoize
allows memoization of expensive functions and is more robust thanFunction#once
.
New Features
- Added ability for
String#stripTags
andStrip#removeTags
to pass a callback. - Added a third argument to
Number#bytes
to allow normal SI units. - Added ability to pass a single string to
Date.range
, for exampleDate.range('monday to thursday')
. - Allow
String#each
to break the loop withfalse
. - Updated
Array#sortBy
to handle sorting on multiple properties. - Fixed
String#unescapeHTML
to handle HTML (and hex) codes, as well as 
- Set a global thousands and decimal marker with
Number.thousands
andNumber.decimal
.
Bugfixes
- Fixed issue with the digit
ten
in date creation. - Fixed issue with the
Date#[unit]Since
improperly 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#every
not 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
since
andfromNow
methods 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.size
to the object package. If you were using custom builds previously be aware of this.