incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r425107 - /incubator/xap/trunk/src/xap/util/ArrayHelper.js
Date Mon, 24 Jul 2006 16:16:00 GMT
Author: mturyn
Date: Mon Jul 24 09:15:59 2006
New Revision: 425107

URL: http://svn.apache.org/viewvc?rev=425107&view=rev
Log:
Added pushAll() to simplify adding one array's contents into another.

Modified:
    incubator/xap/trunk/src/xap/util/ArrayHelper.js

Modified: incubator/xap/trunk/src/xap/util/ArrayHelper.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/ArrayHelper.js?rev=425107&r1=425106&r2=425107&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/util/ArrayHelper.js (original)
+++ incubator/xap/trunk/src/xap/util/ArrayHelper.js Mon Jul 24 09:15:59 2006
@@ -76,4 +76,22 @@
 		}
 	}
 	return -1;
+}
+
+
+/**
+ * Adds all the contents of an array to the original array.
+ * 
+ * @param {Array} array The array to which to add.
+ * @param {Array} newElements An array .
+ * @return {Array} The altered array, so we can chain this.
+ */ 
+xap.util.ArrayHelper.pushAll = function( array, newElements){
+	if (!array || !newElements || !newElements.length){
+		return array;
+	}	
+	for (var i =0; i<newElements.length; ++i){
+		array.push( newElements[i] ) ;
+	}
+	return array ;
 }



Mime
View raw message