'use strict';

const productsFromCSV = (csv) =>
  csv
    .split('\n')
    .slice(1)
    .map((str) => str.trim());

const productsCSV = `name, category, price
  Klingon Letter Opener, Office Warfare, 19.99
  Backpack of Holding, Travel, 29.99
  Tardis Alarmclock, Merchandise, 15.99`;

const products = productsFromCSV(productsCSV);
console.log(products);
