Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
await-first
Advanced tools
Wait the first event in a set of event emitters and event pairs, then clean up after itself.
Wait the first event in a set of event pairs, then clean up after itself.
$ npm install await-first --save
awaitFirst(ee, events)
const EventEmitter = require('events');
const awaitFirst = require('await-first');
async function waitMessageOrClose(ee) {
const o = await awaitFirst(ee, [ 'message', 'close' ]);
switch (o.event) {
case 'message':
const msg = o.args[0]; // [ 'hello world' ]
console.log('new message =>', msg);
break;
case 'close':
console.log('closed');
break;
}
}
const ee = new EventEmitter();
waitMessageOrClose(ee);
setTimeout(() => {
ee.emit('message', 'hello world');
}, 1000);
obj.awaitFirst(events)
const net = require('net');
const awaitFirst = require('await-first');
async function connect() {
const socket = net.connect(8080, '127.0.0.1');
socket.awaitFirst = awaitFirst;
try {
// wait `connect` or `error` event
await socket.awaitFirst([ 'connect', 'error' ]);
} catch (err) {
console.log(err);
}
// ...
}
connect();
FAQs
Wait the first event in a set of event emitters and event pairs, then clean up after itself.
The npm package await-first receives a total of 22,326 weekly downloads. As such, await-first popularity was classified as popular.
We found that await-first demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.