function toArray(val) {
    return isNodeList(val) ? Array.prototype.slice.call(val) : Array.prototype.concat(val);
  }
Converts a value to an array or clones an array.

@param {*} val
@returns {Array}