function populateResult (list) {
    if (!Array.isArray(list)) {
      result.push(list)
    } else if (list.length > 0) {
      for (let item of list) if (item) populateResult(item)
    }
  }
This function returns a flattened list of elements from an array of lists.
@function
@param {*} list - List.
@returns Flattened list.