This is a more updated version of my jsLibrary repo, but without all the jQuery nonsense and some added methods/functionality.
JHUtils.js - Unminified version. JHUtils.min.js - Minified version JHUtils.underscore.js - Unminified Version (requires underscorejs to be available) JHUtils.underscore.min.js - Minified Version (requires underscorejs to be available)
Sorts the received array's values in ASC order and returns a new array for it. Note: This method only works for a 2-d array such as var myArray = [1,2,3,4,5..];
var originalArr = ['z','b','a']; var sortedArr = JHUtils.ascSort(originalArr); // sortedArr == ['a','b','z'];
This is basically a primative version of underscorejs' memoize(). See their documentation for more information.
Returns an array composed of all unique values from the received array. Note: This method only works for a 2-d array such as var myArray = [1,2,3,4,5..];
Just a quick helper method to test for a valid integer. There may obviously be better, more effecient ways of doing this sort of thing - but such things are a bit more overkill for my tastes. In the real world (for me at least) - this does the job just fine.
Check the documentation at coderholic for usage and original source
Just a helper method to log to console. obj is an optional value that, if supplied, will have its raw value printed immediately after the message.
JHUtils.log("Hello World"); JHUtils.log("All Your Base ", { are: "belong", to: "us" });