
Security News
Meet the Socket Team at RSAC and BSidesSF 2025
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
array-to-events
Advanced tools
Push a series of events to an emitter. Useful for testing.
$ npm install --save array-to-events
import arrayToEvents from 'array-to-events';
arrayToEvents(targetEmitter, [
['foo', 'fooArg1', 'fooArg2'],
['bar', 'barArg1', 'barArg2']
]);
// pushes both a 'foo' and 'bar' event (with specified arguments) to the emitter.
Returns: stop
callback
Emit a series of events on targetEmitter
. Depending on the specified options, events will be emitted synchronously or at specified intervals. In async mode, a stop
callback is returned that, when called, will prevent further events from being emitted.
Required
Type: EventEmitter
The emitter where events will be pushed
Required
Type: two dimensional array
An array of event argument arrays. Must be a two dimensional array. The first value of each child array must be a string
value with the event name. Additional array members will be passed as arguments when the array is triggered.
[
['foo', 1],
['bar', 2]
]
The above defines two events. First a foo
event will be emitted with argument 1
. Then a bar
event will be emitted with argument 2
.
Type: boolean
Default: it depends
If true
, all events will be emitted immediately and synchronously, one right after the other. It defaults to true
unless the delay
option or done
callback are specified (in which case it defaults to false
). Explicitly setting it to true
will cause the delay
option to be ignored.
Type: a number or the string "immediate"
Default: "immediate"
If set to "immediate"
, events fire asynchronously with a minimal delay in between (setImmediate
is used to schedule the next event).
If set to a number
, events are scheduled every delay
milliseconds (via setTimeout(nextEvent, opts.delay)
).
Type: callback(error, finished)
An optional callback to be executed when all events have finished. The first argument will contain any error thrown during execution (not currently implemented). The second argument (finished
) will be true
if every event was emitted, false
if the event stream was stopped prematurely using the stop
function.
MIT © James Talmage
FAQs
Push a series of events to an emitter. Useful for testing.
We found that array-to-events 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
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.