const require_utils_ensureMongoDocumentToObject = require('../ensureMongoDocumentToObject.cjs');

//#region src/utils/mapper/user.ts
/**
* Formats a user for API response. Removes sensitive information and adds role.
* @param user - The user object to format.
* @returns The formatted user object.
*/
const mapUserToAPI = (user) => {
	if (!user) return null;
	const { provider, session,...userAPI } = require_utils_ensureMongoDocumentToObject.ensureMongoDocumentToObject(user);
	return userAPI;
};
/**
* Formats an array of users for API response. Removes sensitive information and adds role.
* @param users - The array of user objects to format.
* @returns The formatted array of user objects.
*/
const mapUsersToAPI = (users) => users.map(mapUserToAPI).filter(Boolean);

//#endregion
exports.mapUserToAPI = mapUserToAPI;
exports.mapUsersToAPI = mapUsersToAPI;
//# sourceMappingURL=user.cjs.map