aboutsummaryrefslogtreecommitdiff
path: root/js/lib/prototypes.js
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-15 04:40:37 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-15 04:40:37 +0000
commitdbebcadbc14737ccd151e3225b0a2deede14b5ff (patch)
treed56ef5cc682f65af2df921c3f985a77dfc45e66c /js/lib/prototypes.js
parent75f8dee670c207d464937cf2baf6b6898370f52a (diff)
downloadelgg-dbebcadbc14737ccd151e3225b0a2deede14b5ff.tar.gz
elgg-dbebcadbc14737ccd151e3225b0a2deede14b5ff.tar.bz2
Refs #2538: Added documentation to most of the JS methods missing it.
git-svn-id: http://code.elgg.org/elgg/trunk@8717 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/lib/prototypes.js')
-rw-r--r--js/lib/prototypes.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/lib/prototypes.js b/js/lib/prototypes.js
index 0f0014818..cb6184097 100644
--- a/js/lib/prototypes.js
+++ b/js/lib/prototypes.js
@@ -1,5 +1,14 @@
/**
+ * Interates through each element of an array and calls a callback function.
+ * The callback should accept the following arguments:
+ * element - The current element
+ * index - The current index
*
+ * This is different to Array.forEach in that if the callback returns false, the loop returns
+ * immediately without processing the remaining elements.
+ *
+ * @param {Function} callback
+ * @return {Bool}
*/
if (!Array.prototype.every) {
Array.prototype.every = function(callback) {
@@ -16,7 +25,16 @@ if (!Array.prototype.every) {
}
/**
+ * Interates through each element of an array and calls callback a function.
+ * The callback should accept the following arguments:
+ * element - The current element
+ * index - The current index
+ *
+ * This is different to Array.every in that the callback's return value is ignored and every
+ * element of the array will be parsed.
*
+ * @param {Function} callback
+ * @return {Void}
*/
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback) {
@@ -31,7 +49,11 @@ if (!Array.prototype.forEach) {
}
/**
+ * Left trim
*
+ * Removes a character from the left side of a string.
+ * @param {String} str The character to remove
+ * @return {String}
*/
if (!String.prototype.ltrim) {
String.prototype.ltrim = function(str) {