Skip to content

Commit 2f6b31e

Browse files
committed
Use object keys to prevent accidental iteration over prototype properties
1 parent b25264f commit 2f6b31e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

js/src/code-interpreter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ export class JupyterExtension {
231231
* Close all the websocket connections to the kernels. It doesn't shutdown the kernels.
232232
*/
233233
async close() {
234-
// TODO: For in check
235-
for (const kernelID in this.connectedKernels) {
234+
for (const kernelID of Object.keys(this.connectedKernels)) {
236235
this.connectedKernels[kernelID].close()
237236
}
238237
}

js/src/messaging.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ export class Data {
113113
this.raw = data
114114

115115
this.extra = {}
116-
// TODO: For in check
117-
for (const key in data) {
116+
for (const key of Object.keys(data)) {
118117
if (![
119118
'text/plain',
120119
'text/html',

0 commit comments

Comments
 (0)