flattenArray = arr =>
  arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flattenArray(val) : val), [])
recursively flatten a nested array
@param {Array} arr to be flattened
@return {Array} flattened array