19 lines
723 B
JavaScript
19 lines
723 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.presentVehicle = presentVehicle;
|
|
exports.presentVehicleList = presentVehicleList;
|
|
function normalizeLocations(value) {
|
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === 'string') : [];
|
|
}
|
|
function presentVehicle(vehicle) {
|
|
return {
|
|
...vehicle,
|
|
pickupLocations: normalizeLocations(vehicle?.pickupLocations),
|
|
allowDifferentDropoff: Boolean(vehicle?.allowDifferentDropoff),
|
|
dropoffLocations: normalizeLocations(vehicle?.dropoffLocations),
|
|
};
|
|
}
|
|
function presentVehicleList(vehicles, meta) {
|
|
return { data: vehicles, ...meta };
|
|
}
|
|
//# sourceMappingURL=vehicle.presenter.js.map
|