Skip to content

Commit 34e4dcb

Browse files
geropljankeromnes
authored andcommitted
[tracing] Use instanceof as safer alternative to typeof
Co-authored-by: Jan Keromnes <[email protected]>
1 parent fdc317a commit 34e4dcb

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

components/gitpod-protocol/src/util/tracing.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ export namespace TraceContext {
141141
try {
142142
for (const k of Object.keys(keyValueMap)) {
143143
const v = keyValueMap[k];
144-
// oh my JavaScript... `typeof null` and `typeof undefined` return `object`
145-
if (v !== null
146-
&& v !== undefined
147-
&& typeof v === 'object') {
144+
if (v instanceof Object) {
148145
addNestedTags(ctx, v, `${namespace}${k}`);
149146
} else {
150147
ctx.span.setTag(`${namespace}${k}`, v);

0 commit comments

Comments
 (0)