Add eqeqeq rule but require == for null
This commit is contained in:
parent
64a4d2e717
commit
0086216c9d
30 changed files with 64 additions and 63 deletions
|
@ -20,7 +20,7 @@ export default class EventTarget {
|
|||
if (!(ev instanceof Event)) {
|
||||
throw new Error('Expects an event');
|
||||
}
|
||||
if (this.listeners === null || typeof this.listeners !== 'object') {
|
||||
if (this.listeners == null || typeof this.listeners !== 'object') {
|
||||
this.listeners = {};
|
||||
}
|
||||
const listeners = this.listeners[ev.type];
|
||||
|
@ -44,7 +44,7 @@ export default class EventTarget {
|
|||
if (typeof callback !== 'function') {
|
||||
throw new Error('Second argument expects a function');
|
||||
}
|
||||
if (this.listeners === null || typeof this.listeners !== 'object') {
|
||||
if (this.listeners == null || typeof this.listeners !== 'object') {
|
||||
this.listeners = {};
|
||||
}
|
||||
let listeners = this.listeners[eventName];
|
||||
|
@ -62,7 +62,7 @@ export default class EventTarget {
|
|||
if (typeof callback !== 'function') {
|
||||
throw new Error('Second argument expects a function');
|
||||
}
|
||||
if (this.listeners === null || typeof this.listeners !== 'object') {
|
||||
if (this.listeners == null || typeof this.listeners !== 'object') {
|
||||
this.listeners = {};
|
||||
}
|
||||
const listeners = this.listeners[eventName];
|
||||
|
|
|
@ -56,7 +56,7 @@ function ensureStringed(thing: any): any {
|
|||
|
||||
return res;
|
||||
}
|
||||
if (thing === null) {
|
||||
if (thing == null) {
|
||||
return null;
|
||||
}
|
||||
throw new Error(`unsure of how to jsonify object of type ${typeof thing}`);
|
||||
|
|
|
@ -755,7 +755,7 @@ export default class MessageReceiver
|
|||
id: item.id,
|
||||
receivedAtCounter: item.receivedAtCounter ?? item.timestamp,
|
||||
receivedAtDate:
|
||||
item.receivedAtCounter === null ? Date.now() : item.timestamp,
|
||||
item.receivedAtCounter == null ? Date.now() : item.timestamp,
|
||||
messageAgeSec: item.messageAgeSec || 0,
|
||||
|
||||
// Proto.Envelope fields
|
||||
|
|
|
@ -293,7 +293,7 @@ class Message {
|
|||
throw new Error('Invalid timestamp');
|
||||
}
|
||||
|
||||
if (this.expireTimer !== undefined && this.expireTimer !== null) {
|
||||
if (this.expireTimer != null) {
|
||||
if (typeof this.expireTimer !== 'number' || !(this.expireTimer >= 0)) {
|
||||
throw new Error('Invalid expireTimer');
|
||||
}
|
||||
|
@ -311,8 +311,8 @@ class Message {
|
|||
}
|
||||
if (this.isEndSession()) {
|
||||
if (
|
||||
this.body !== null ||
|
||||
this.group !== null ||
|
||||
this.body != null ||
|
||||
this.group != null ||
|
||||
this.attachments.length !== 0
|
||||
) {
|
||||
throw new Error('Invalid end session message');
|
||||
|
@ -674,7 +674,7 @@ export default class MessageSender {
|
|||
>
|
||||
): Promise<Proto.IAttachmentPointer> {
|
||||
assert(
|
||||
typeof attachment === 'object' && attachment !== null,
|
||||
typeof attachment === 'object' && attachment != null,
|
||||
'Got null attachment in `makeAttachmentPointer`'
|
||||
);
|
||||
|
||||
|
|
|
@ -76,10 +76,7 @@ function processGroupContext(
|
|||
}
|
||||
|
||||
strictAssert(group.id, 'group context without id');
|
||||
strictAssert(
|
||||
group.type !== undefined && group.type !== null,
|
||||
'group context without type'
|
||||
);
|
||||
strictAssert(group.type != null, 'group context without type');
|
||||
|
||||
const masterKey = deriveMasterKeyFromGroupV1(group.id);
|
||||
const data = deriveGroupFields(masterKey);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue