Utility Functions
What utility functions are available?
The ATG Recommendations JavaScript include comes with a number of potentially useful utility functions you may utilize. A few of these are listed in the documentation for writing Renderers and Recommendation Builders, but the rest are listed here.
CleverSet.util.clone(js_object)Deep clones a JavaScript data object.
Parameters
js_object—any JavaScript variable
Returns
a deep copy of the JavaScript variable passed as the parameter
CleverSet.util.within(number1, number2, range)Checks to see if the two numbers are within a range of one another.
Parameters
number1—the first number to check
number2—the second number to check
range—a numeric range they must be within
Returns
true if the two numbers are within the range of one another, false if not
jQuery
The ATG Recommendations JavaScript also includes an almost complete copy of jQuery. jQuery is a fantastic library that includes a huge amount of functionality and browser compatibility in a very small core.
The included jQuery may be accessed through the global variable CleverSet$.
The version currently included is jQuery 1.1.3.1.
The only jQuery code that is not included is the AJAX library.
Documentation on the use of jQuery may be found at http://docs.jquery.com, though the documentation may not match the included version.
