UNPKG

dtable-utils

Version:

dtable common utils

38 lines (35 loc) 1.16 kB
import _classCallCheck from '@babel/runtime/helpers/classCallCheck'; import _createClass from '@babel/runtime/helpers/createClass'; var PatchUtils = /*#__PURE__*/function () { function PatchUtils() { _classCallCheck(this, PatchUtils); } return _createClass(PatchUtils, null, [{ key: "getUsername", value: function getUsername(username) { if (typeof window !== 'undefined') { return window.dtable && window.dtable.username; } // username maybe not a email(form) if (username && username.indexOf('@') === -1) return ''; return username; } }, { key: "getUserId", value: function getUserId(userId) { if (typeof window !== 'undefined') { return window.dtable && window.dtable.userId; } return userId; } }, { key: "getUserDepartmentIdsMap", value: function getUserDepartmentIdsMap(userDepartmentIdsMap) { if (typeof window !== 'undefined' && window.dtable && window.dtable.userDepartmentIdsMap) { return window.dtable.userDepartmentIdsMap; } return userDepartmentIdsMap; } }]); }(); export { PatchUtils as default };