code: function flattenInternal(output, element) {
    if (element) {
      element.forEach((obj) => {
        if (Array.isArray(obj)) {
          flattenInternal(output, obj);
        } else {
          output.push(obj);
        }
      });
    }
  }
docs: Recursive function for flattening an iterable.
  
  @param {object} output - base object to be updated
  @param {object} element - input object to be merged into the output