@putkoff/abstract-utilities 0.1.212 → 0.1.214

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -185,16 +185,13 @@ function isTokenExpired(token) {
185
185
  }
186
186
  /** Convenience wrapper: return username from the JWT (or null). */
187
187
  function currentUsername() {
188
- const tok = getToken();
189
- if (!tok)
190
- return null;
191
- try {
192
- const { username } = decodeJwt(tok);
193
- return username !== null && username !== void 0 ? username : null;
194
- }
195
- catch (_a) {
196
- return null;
188
+ const token = getToken();
189
+ let uName = null;
190
+ if (token) {
191
+ const decodedJwt = decodeJwt(token) || {};
192
+ uName = (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.username) || null;
197
193
  }
194
+ return uName;
198
195
  }
199
196
  function currentUsernames() {
200
197
  var _a;