I work on the front-end part of Zero RRD framework again. It was a very basic interface and the usability wasn’t, well isn’t that good.

The new stuff is mostly JavaScript and I needed to check if a variable is an array or not. I found the snippet at bram.us, but it isn’t fully working for me.

The problem is with variables that are null in that case you’ll run into an error. The slightly improved version takes that into account.

1
2
3
4
function isArray(obj) {
    if (obj == null) return false;
    return obj.constructor == Array;
}