It might be better to use utility function provided by nodejs.
See util.isArray(object)