@putkoff/abstract-utilities 0.1.212 → 0.1.213

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/cjs/index.js CHANGED
@@ -188,16 +188,13 @@ function isTokenExpired(token) {
188
188
  }
189
189
  /** Convenience wrapper: return username from the JWT (or null). */
190
190
  function currentUsername() {
191
- const tok = getToken();
192
- if (!tok)
193
- return null;
194
- try {
195
- const { username } = decodeJwt(tok);
196
- return username !== null && username !== void 0 ? username : null;
197
- }
198
- catch (_a) {
199
- return null;
191
+ const token = getToken();
192
+ let uName = null;
193
+ if (token) {
194
+ const decodedJwt = decodeJwt(token) || {};
195
+ uName = (decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.username) || null;
200
196
  }
197
+ return uName;
201
198
  }
202
199
  function currentUsernames() {
203
200
  var _a;