You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/07/19 19:33:23 UTC
svn commit: r423579 - /incubator/xap/trunk/src/xap/util/Utils.js
Author: mturyn
Date: Wed Jul 19 12:33:19 2006
New Revision: 423579
URL: http://svn.apache.org/viewvc?rev=423579&view=rev
Log:
Trimmed some ArrayHelper-like kruft, added an optional parameter to interrogate() so that we can suppress listing functions when we're examining an object.
Modified:
incubator/xap/trunk/src/xap/util/Utils.js
Modified: incubator/xap/trunk/src/xap/util/Utils.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/Utils.js?rev=423579&r1=423578&r2=423579&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/util/Utils.js (original)
+++ incubator/xap/trunk/src/xap/util/Utils.js Wed Jul 19 12:33:19 2006
@@ -43,12 +43,18 @@
/**
* Method for debugging---less than a full object-dump, more than toString()
**/
-xap.util.Utils.interrogate = function(obj){
+xap.util.Utils.interrogate = function(obj,withFun){
var s="" ;
if (typeof obj != "object"){
s = "<not an object>" ;
} else {
- for (var keyy in obj){ s += "^"+keyy+':'+obj[keyy] ; }
+ for (var keyy in obj){
+ var valStr = ""+obj[keyy] ;
+ if (valStr.substring(0,8)=="function" && !withFun){
+ continue ;
+ }
+ s += "^"+keyy+':'+valStr ;
+ }
}
// Puts the result, with CR/LFs turned to carets, into
// the copyable part of a prompt box:
@@ -57,31 +63,5 @@
-/**
- * Does an array contain an element?
- * @param anArray an array
- * @param elem
- * @return true/false if the array does/n't contain at least one el: el == elem
-**/
-xap.util.Utils.doesArrayContain = function(anArray, anObject){
- return (xap.util.Utils.indexOfFirst(anArray, anObject)>-1) ;
-}
-
-/**
- * At what index can you find a given element?
- * @param anArray an array
- * @param elem
- * @return index>=0 if the array contains at least one el: el == elem, -1 otherwise:
-**/
-xap.util.Utils.indexOfFirst = function(anArray, anObject){
- var result=-1 ;
- for (var i=0; i<anArray.length; ++i){
- if (anArray[i]==anObject){
- result = i ;
- break ;
- }
- }
- return result ;
-}