Mirror: 🎩 A tiny but capable push & pull stream library for TypeScript and Flow
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix zip/combine for...in iterating inherited properties (#177)

authored by

Carl-Philip Majgaard and committed by
GitHub
f00ba1c0 70815c21

+10 -4
+5
.changeset/twenty-paws-cry.md
··· 1 + --- 2 + 'wonka': patch 3 + --- 4 + 5 + Replace for...in with for...of Object.keys() to avoid iterating inherited properties
+5 -4
src/combine.ts
··· 61 61 let ended = false; 62 62 let endCount = 0; 63 63 64 - for (const key in sources) { 64 + const keys = Object.keys(sources); 65 + for (const key of keys) { 65 66 (sources[key] as Source<T>)(signal => { 66 67 if (signal === SignalKind.End) { 67 68 if (endCount >= size - 1) { ··· 77 78 filled.add(key); 78 79 if (!gotBuffer && filled.size < size) { 79 80 if (!gotSignal) { 80 - for (const key in sources) 81 + for (const key of keys) 81 82 if (!filled.has(key)) (talkbacks[key] || talkbackPlaceholder)(TalkbackKind.Pull); 82 83 } else { 83 84 gotSignal = false; ··· 96 97 /*noop*/ 97 98 } else if (signal === TalkbackKind.Close) { 98 99 ended = true; 99 - for (const key in talkbacks) talkbacks[key](TalkbackKind.Close); 100 + for (const key of Object.keys(talkbacks)) talkbacks[key](TalkbackKind.Close); 100 101 } else if (!gotSignal) { 101 102 gotSignal = true; 102 - for (const key in talkbacks) talkbacks[key](TalkbackKind.Pull); 103 + for (const key of Object.keys(talkbacks)) talkbacks[key](TalkbackKind.Pull); 103 104 } 104 105 }) 105 106 );