File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -111,9 +111,8 @@ export class Connection implements IConnection {
111
111
else valueToSend = value ;
112
112
} ) ;
113
113
114
- // If the message is an object, and it's empty, it makes no sense to send it
115
- // All other messages (e.g. non-empty objects or primitives) must be sent
116
- if ( ! ( typeof valueToSend === 'object' && Object . keys ( valueToSend ) . length == 0 ) ) {
114
+ // Checking if valueToSend is NOT {}
115
+ if ( Utils . isNotAnEmptyObject ( valueToSend ) ) {
117
116
messages . push ( { topic, propertyName : current , value : valueToSend } ) ;
118
117
}
119
118
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ function isArray<T>(value: CloudMessageValue): value is T[] {
31
31
return Array . isArray ( value ) ;
32
32
}
33
33
34
+ function isNotAnEmptyObject ( value ) : boolean {
35
+ return ! ( typeof value === 'object' && Object . keys ( value ) . length == 0 ) ;
36
+ }
37
+
34
38
function toArrayBuffer ( buf : { length : number } ) : ArrayBuffer {
35
39
const ab = new ArrayBuffer ( buf . length ) ;
36
40
const view = new Uint8Array ( ab ) ;
@@ -69,4 +73,5 @@ export default {
69
73
toArrayBuffer,
70
74
toBuffer,
71
75
arrayBufferToBase64,
76
+ isNotAnEmptyObject,
72
77
} ;
You can’t perform that action at this time.
0 commit comments