UNPKG

jsm-core

Version:
26 lines (25 loc) 1.06 kB
"use strict"; /** * @generator Levelup * @author dr. Salmi <reevosolutions@gmail.com> * @since 27-02-2024 21:22:10 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getUserSnapshot = void 0; /* ------------------------- COMMON AUTH INTERFACES ------------------------- */ const getUserSnapshot = (value, default_value = null) => { var _a, _b, _c, _d; if (!value) return default_value !== null && default_value !== void 0 ? default_value : null; const result = { role: value.role, _id: value._id, tracking_id: value.tracking_id, first_name: ((_a = value.profile) === null || _a === void 0 ? void 0 : _a.first_name) || '', family_name: ((_b = value.profile) === null || _b === void 0 ? void 0 : _b.family_name) || '', phones: ((_c = value.profile) === null || _c === void 0 ? void 0 : _c.phones) || [], photo: ((_d = value.profile) === null || _d === void 0 ? void 0 : _d.photo) || null, }; return result; }; exports.getUserSnapshot = getUserSnapshot;