const makeBylines = function makeBylines(authors) {
  if (authors.length === 1) {
    return authors[0];
  }
  if (authors.length === 0) {
    return null;
  }
  const output = authors.slice();
  const lastAuthor = output.pop();
  const secondToLastAuthor = output.pop();
  const commaAuthors = output.length > 0 ? `${output.join(', ')}, ` : '';
  return `${commaAuthors + secondToLastAuthor} and ${lastAuthor}`;
};
export default makeBylines;