convert = (col, outputType) => {

  if (typeof col !== 'object') {
    throw new InvalidArgumentException(col, outputType);
  }

  if (outputType === 'object') {
    outputType = 'hashmap';
  }

  const mapper = {
    array: col => getValues(col),
    hashmap: col =>
      col instanceof vis.DataSet ? col.get({ returnType: 'Object' }) : col,
    dataset: col =>
      col instanceof vis.DataSet ? col : (!Array.isArray(col) ? getValues(col) : new vis.DataSet(col))
  };

  return mapper[outputType](col);

}
Transforms a collection of a certain type into a collection of
another type.

**Attention**: When trying to convert an array into a object, the
array will be simply bounced back. Let's hope no one added enumerable
properties to Array.prototype :)

@param {Collection} col - The collection to convert.
@param {CollectionTypeString} [outputType="dataset"] - The output type.
@return {Collection} A **new** collection of type `outputType`.