convertListToDict = list => {
  const newList = list instanceof Array ? list : [].concat(list);
  return newList.length > 1
    ? newList.reduce((prev, next) => {
      const accumulator =
          prev instanceof Object
            ? prev
            : {
              [prev]: 1,
            };
      return {
        ...accumulator,
        ...{
          [next]: accumulator[next] ? accumulator[next] + 1 : 1,
        },
      };
    })
    : {
      [newList[0]]: 1,
    };
}
Return an object with {key, value} pairs as {'the string value (name)', 'the occurance of the given name'}

@param  {Array} list    the list which is converted to an dictionary
@return {Object}        the actually dictionary