Sugar v0.9.5 Release Notes
-
API Changes
- .sugar method added to all classes to reinstate Sugar methods conditionally.
- 0๏ธโฃ Object.clone is now shallow by default, with an option for deep cloning
- ๐ Object.merge will now ignore non-objects
- Object.fromQueryString now takes the place of String#toObject.
- ๐ Nested object/array param parsing now possible with Object.fromQueryString.
- ๐ Array#remove now accepts unlimited parameters
- Array#exclude now accepts unlimited parameters
- Array#union now accepts unlimited parameters
- Array#subtract now accepts unlimited parameters
- Array#intersect now accepts unlimited parameters
- ๐ Array#split deprecated
- ๐ Array#compact no longer removes functions (bug)
- Array#compact now accepts flag to compact all falsy values
- Number#upto and Number#downto now accept a third parameter to traverse in multiples of > 1
- Number#pad now accepts a third parameter that is the base of the number
- 0๏ธโฃ Number#hex now accepts a parameter to pad the resulting string with a default of 1
- String#escapeHTML added
- String#truncate added. Will truncate a string without breaking words.
- ๐จ String#toObject now refactored to Object.fromQueryString
- ๐จ Function.lazy refactored to Function#lazy
- Function#lazy functions can now be cancelled via Function#cancel
- ๐ Function#defer deprecated -> use Function#delay instead
- Function#debounce added
- Function#after added
- Function#once added
Internal Changes
- ๐ extendWithNativeCondition removed. Functionality now contained in extend
- ๐ shuffled and removed some dependencies to make it easier to extract the date module
- more robust equality comparison:
- multiArgs added to collect arguments
- array indexes now checked with hasProperty instead of hasOwnProperty
- ๐ object builders are now going through extend so they can store their references
- ๐จ Object.clone refactored to use multiArgs
- Object.isEmpty now returns false if passed argument itself is falsy
- ๐จ String#stripTags refactored to use multiArgs
- ๐จ String#removeTags refactored to use multiArgs -- "null" now taken into consideration for objects -- object key length compared -- strict equality matches in multiMatch