I have been using listProps and found that I would like results listed in alphabetical order. Below is the modified function I came up with.
Code: Select allStdlib.listProps = function(obj) {
var s = [];
var sep = (isBridge() ? "\r" : "\r\n");
for (var x in obj) {
var str = x + ":\t";
try {
var o = obj[x];
str += (typeof o == "function") ? "[function]" : o;
} catch (e) {
}
s.push( str + sep );
}
s.sort();
str="";
for(var p=0;p<s.length;p++){
str += s[p];
}
return str.replace(/.$/,'');
};
Suggested Stdlib.listProps chagne
Suggested Stdlib.listProps chagne
Will this do?
Code: Select allStdlib.listProps = function(obj) {
var s = [];
var sep = (isBridge() ? "\r" : "\r\n");
for (var x in obj) {
var str = x + ":\t";
try {
var o = obj[x];
str += (typeof o == "function") ? "[function]" : o;
} catch (e) {
}
s.push(str);
}
s.sort();
return s.join(sep);
};
Code: Select allStdlib.listProps = function(obj) {
var s = [];
var sep = (isBridge() ? "\r" : "\r\n");
for (var x in obj) {
var str = x + ":\t";
try {
var o = obj[x];
str += (typeof o == "function") ? "[function]" : o;
} catch (e) {
}
s.push(str);
}
s.sort();
return s.join(sep);
};
Suggested Stdlib.listProps chagne
Knew you would be able to come up with a better way. Thanks.