ipc-iterate-twice.js
This file
Path
test/fixtures/ipc-iterate-twice.js
17 lines · 592 bytes · JavaScript
Last changed by
Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
History of this fileTake it
123456789101112131415161718#!/usr/bin/env nodeimport {sendMessage, getEachMessage} from '../../index.js';import {foobarString} from '../helpers/input.js';
for (let index = 0; index < 2; index += 1) { // Intentionally not awaiting `sendMessage()` to avoid a race condition sendMessage(foobarString); // eslint-disable-next-line no-await-in-loop for await (const message of getEachMessage()) { if (message === foobarString) { // eslint-disable-next-line unicorn/no-break-in-nested-loop -- breaks only the inner loop, the outer loop must continue break; }
await sendMessage(`${index}${message}`); }}