Решено: передал параметр в вызов функции
main.js
const getReport = async function() {
const jsonlUrl = 'https://next.json-generator.com/api/json/get/xxxxx'
const res = await fetch(jsonlUrl);
const orders = await res.json();
const orderlines = orders.map(order => ({
order_id: order.order_id,
customer_name: getName(order)
}));
Я добавил параметр в функцию getName
function.js
const getName = function(order) {
const customerName = order.customer_name
return customerName
}