HexagonJS
Util Changelog
2.7.1
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.7.0
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.5.3
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.5.2
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.5.1
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.5.0
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.4.0
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.3.1
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.3.0
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.2.0
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.1.0
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.0.3
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.0.2
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.0.1
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
2.0.0
hx.versionString
Added
The version property to allow easy identification of what hexagon version is in use.
hx.merge.definedObject
Deprecated
Replaced by hx.mergeDefined
hx.mergeDefinedObject
Added
Merges multiple objects together, only copying across defined values and returns the result as a new object.
The objects will be merged recursively, and arrays will be cloned. Any object that is not a plain object (see the isPlainObject function) will be replaced with an empty object {}.
// returns {'a': 1, 'b': 3}
hx.mergeDefined({'a': 1}, {'a': undefined}, {'b': 3})

// returns {a: {b: 2, c: {d: 4, e: 'value'}}}
hx.mergeDefined({a: {b: 2, c: {d: 3}}}, {a: {b: undefined, c: {d: 4, e: 'value'}}})
hx.shallowMerge.definedObject
Deprecated
Replaced by hx.shallowMergeDefined
hx.shallowMergeDefinedObject
Added
Merges multiple objects together where the first level of references are copied provided they are defined values (not undefined), and returns the result as a new object.
// returns {'a': 1, 'b': 3}
hx.shallowMergeDefined({'a': 1}, {'a': undefined}, {'b': 3})

// returns {a: {b: undefined, c: {d: 4, e: "value" }}}
hx.shallowMergeDefined({a: {b: 2, c: {d: 3}}}, {a: {b: undefined, c: {d: 4, e: 'value'}}})
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
1.20.0
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
1.19.0
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
1.18.1
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
1.17.1
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
1.17.0
hx.parseHTMLDocumentFragment
Deprecated
#375
The html method for selections has been removed to prevent XSS attacks.
1.5.0
hx.minByAny
Bugfix
Fix an issue where the last value in the array wasn't being checked
hx.maxByAny
Bugfix
Fix an issue where the last value in the array wasn't being checked
hx.argminNumber
Added
Added a function for getting the index of the item in an array with the lowest value
hx.argmaxNumber
Added
Added a function for getting the index of the item in an array with the highest value
hx.isNumberBoolean
Added
#240
Added a function for checking if something is a Number
1.3.2
hx.definedBoolean
Bugfix
#226
Will now returns false when null is passed in
0.15.2
hx.checkParents
Added
A function for checking a node and it's parents for properties or contents.
This function will return the first non-undefined result by default or an array of all the non-undefined results if returnArray is true.
hx.parentZIndex
Added
A function for checking a node's parents to find the first element with a z-index.
hx.debounce
Added
A function that prevents multiple calls to a function from being called in quick succession.
This is useful for calling an event when a user is inputting data, such as typing in an input field, to prevent a callback being run for every character entered.
0.14.0
hx.mergeObject
Removed
hx.shallowMergeObject
Removed
0.13.0
hx.mergeObject
Deprecated
hx.shallowMergeObject
Deprecated
hx.mergeObject
Added
Merges multiple objects together, and returns the result as a new object.
The objects will be merged recursively, and arrays will be cloned. Any object that is not a plain object (see the isPlainObject function) will be replaced with an empty object {}.
// returns {'a': 2, 'b': 3}
hx.merge({'a': 1}, {'a': 2}, {'b': 3})

// returns {a: {b: 'hello', c: {d: 4, e: 'value'}}}
hx.merge({a: {b: 2, c: {d: 3}}}, {a: {b: 'hello', c: {d: 4, e: 'value'}}})
hx.merge.definedObject
Added
Merges multiple objects together, only copying across defined values and returns the result as a new object.
The objects will be merged recursively, and arrays will be cloned. Any object that is not a plain object (see the isPlainObject function) will be replaced with an empty object {}.
// returns {'a': 1, 'b': 3}
hx.merge.defined({'a': 1}, {'a': undefined}, {'b': 3})

// returns {a: {b: 2, c: {d: 4, e: 'value'}}}
hx.merge.defined({a: {b: 2, c: {d: 3}}}, {a: {b: undefined, c: {d: 4, e: 'value'}}})
hx.shallowMergeObject
Added
Merges multiple objects together where the first level of references are copied, and returns the result as a new object.
// returns {'a': 2, 'b': 3}
hx.shallowMerge({'a': 1}, {'a': 2}, {'b': 3})

// returns {a: {b: 'hello', c: {d: 4, e: 'value'}}}
hx.shallowMerge({a: {b: 2, c: {d: 3}}}, {a: {b: 'hello', c: {d: 4, e: 'value'}}})
hx.shallowMerge.definedObject
Added
Merges multiple objects together where the first level of references are copied provided they are defined values (not undefined), and returns the result as a new object.
// returns {'a': 1, 'b': 3}
hx.shallowMerge.defined({'a': 1}, {'a': undefined}, {'b': 3})

// returns {a: {b: undefined, c: {d: 4, e: "value" }}}
hx.shallowMerge.defined({a: {b: 2, c: {d: 3}}}, {a: {b: undefined, c: {d: 4, e: 'value'}}})
hx.isBooleanBoolean
Added
Returns true if the value passed in is a boolean
hx.isBoolean("i am a string")                // returns false
hx.isBoolean({})                             // returns false
hx.isBoolean(document.createElement('div'))  // returns false
hx.isBoolean([])                             // returns false
hx.isBoolean(123)                            // returns false
hx.isBoolean(function(){})                   // returns false
hx.isBoolean(true)                           // returns true
hx.isBoolean(false)                          // returns true
0.12.6
hx.scrollbarSizeNumber
Added
A method for getting the offset amount of the scrollbars in the current browser.
Different browsers implement scrollbars in different ways, with some changing the content size. This method returns the offset amount to allow for any structural changes that need to be made reliably across browsers.
0.9.0
hx.minNumber
Removed
Apply transformations before passing into min
// old way
hx.min(array, f)

// new way
hx.min(array.map(f))
hx.minNumber
Added
Returns the minimum value in the array
hx.min([7, 6, 3, 5]) // returns 3
hx.maxNumber
Removed
Apply transformations before passing into max
// old way
hx.max(array, f)

// new way
hx.max(array.map(f))
hx.maxNumber
Added
Returns the maximum value in the array
hx.max([7, 6, 3, 5]) // returns 7
hx.mergeObject
Added
Merges multiple objects together, and returns the result as a new object.
The objects will be merged recursively, and arrays will be cloned. Any object that is not a plain object (see the isPlainObject function) will be replaced with an empty object {}.
// returns {'a': 2, 'b': 3}
hx.merge(false, {'a': 1}, {'a': 2}, {'b': 3})

// returns {a: {b: 'hello', c: {d: 4, e: 'value'}}}
hx.merge(true, {a: {b: 2, c: {d: 3}}}, {a: {b: 'hello', c: {d: 4, e: 'value'}}})
hx.shallowMergeObject
Added
Merges multiple objects together where the first level of references are copied, and returns the result as a new object.
// returns {'a': 2, 'b': 3}
hx.merge(false, {'a': 1}, {'a': 2}, {'b': 3})

// returns {a: {b: 'hello', c: {d: 4, e: 'value'}}}
hx.merge(true, {a: {b: 2, c: {d: 3}}}, {a: {b: 'hello', c: {d: 4, e: 'value'}}})
hx.cloneObject / Array
Removed
hx.cloneObject / Array
Added
Clones an object or array. Items in arrays will also be cloned.
hx.shallowCloneObject / Array
Added
Clones an object or array. Only the first level of values in the objects will be copied - this function will not recursively clone items - meaning references will be copied.
hx.extend
Removed
Use hx.merge or hx.shallowMerge