Skip to content

Commit 84e8b2a

Browse files
committed
Check for null and undefined explicitly
1 parent e921efb commit 84e8b2a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

rakam.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ Rakam.prototype.setUserId = function (userId) {
636636
var previousUserId = this.options.userId;
637637
this.options.userId = (userId !== undefined && userId !== null && ('' + userId)) || null;
638638

639-
if (userId !== null && userId !== undefined && ((this._eventId > 0 && previousUserId === null) ||
640-
(previousUserId !== null && this.deviceIdCreatedAt !== undefined))) {
639+
if (userId !== null && userId !== undefined && ((this._eventId > 0 && (previousUserId === null || previousUserId === undefined)) ||
640+
(previousUserId !== null && previousUserId !== undefined && this.deviceIdCreatedAt !== undefined))) {
641641
var _this = this;
642642
this.User()._merge(previousUserId, this.deviceIdCreatedAt, function () {
643643
_this.deviceIdCreatedAt = undefined;

0 commit comments

Comments
 (0)