function toArray(obj) {
  try {
    return Array.prototype.slice.call(obj);
  } catch (e) {
    const ret = [];
    each(obj, function(val) {
      ret.push(val);
    });
    return ret;
  }
}
Convert value (e.g., a NodeList) to an array.

@param {*} obj The object
@returns {Array<*>}