UNPKG

@fdot/arculus-staff-service

Version:

Simplifies usage of the Arculus Staff Service

34 lines (33 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUsersDisplay = exports.getUserDisplay = void 0; var phoneNumberUtils_1 = require("./phoneNumberUtils"); var getUserDisplay = function (staff, includeEmail, includePhone, includeRacf) { if (staff) { var display = "".concat(staff.lastName, ", ").concat(staff.firstName); if (includeEmail === true && staff.emailAddress) { display += " (".concat(staff.emailAddress, ")"); } if (includePhone === true) { var formattedPhone = (0, phoneNumberUtils_1.formatPhoneNumber)(staff.phone, staff.phoneExtension); if (formattedPhone) { display += " [".concat(formattedPhone, "]"); } } if (includeRacf === true && staff.racfId) { display += " (".concat(staff.racfId, ")"); } return display; } return 'N/A'; }; exports.getUserDisplay = getUserDisplay; var getUsersDisplay = function (staff, includeEmail, includePhone, includeRacf) { if (staff === undefined || staff === null || staff.length === 0) { return 'N/A'; } return staff .map(function (i) { return (0, exports.getUserDisplay)(i, includeEmail, includePhone, includeRacf); }) .join(); }; exports.getUsersDisplay = getUsersDisplay;