sindresorhus / p-event

Promisify an event by waiting for it to be emitted

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thoughts on pattern matching

kmalakoff opened this issue · comments

I have a case where I'm listening to an event emitter, but waiting for a specific pattern in the emitted data. Is this a case that you would be interested in supporting with this module?

pEvent(emitter, 'eventname', (data) => data.id === 5).then(() => {});

Yes, definitely. PR welcome. It was discussed in #3 (comment).

Cool. I'll submit a PR today with some tests.