
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
array-events
Advanced tools
Is an Array extension class which adds asynchronous functions to Array as well as firing events on 'remove', 'add' or 'change'
import { EventedArray } = from 'array-events/array-events.mjs';
// OR: const EventedArray = require('array-events');
const myArray = new EventedArray();
change : fired any time an element is added or removed
add : fired any time an element is added
remove : fired any time an element is removed
EventedArrays are also Emitters but have an expanded syntax from extended-emitter and the additional .when()
call.
myArray.on('change', function(event){ });
myArray.once('change', function(event){ });
myArray.off('change', function(event){ });
myArray.emit('change'[, arguments]);
forEachEmission : execute serially
myArray.forEachEmission(function(item, index, done){
somethingAsynchronous(function(){
done();
});
}, function(){
//we're all done!
});
forAllEmissions : execute all jobs in parallel
myArray.forAllEmissions(function(item, index, done){
somethingAsynchronous(function(){
done();
});
}, function(){
//we're all done!
});
forAllEmissionsInPool : execute all jobs in parallel up to a maximum #, then queue for later
myArray.forAllEmissionsInPool(poolSize, function(item, index, done){
somethingAsynchronous(function(){
done();
});
}, function(){
//we're all done!
});
contains : does the array contain this element?
new EventedArray(['dog', 'cat', 'mouse']).contains('cat') //returns true;
combine : generate a new array that is the union of the provided arrays
new EventedArray(['dog', 'cat']).combine(['mouse']) //returns a new array ['dog', 'cat', 'mouse'];
erase : generate a new array without the member provided
new EventedArray(['dog', 'cat', 'mouse']).erase('cat') //returns a new array ['dog', 'mouse'];
EventedArray.is : is the provided object an instance of EventedArray
EventedArray.is(new EventedArray()); //returns true
EventedArray.is([]) //returns false
just run
mocha
Enjoy,
-Abbey Hawk Sparrow
FAQs
Events and more for arrays
The npm package array-events receives a total of 8,535 weekly downloads. As such, array-events popularity was classified as popular.
We found that array-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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.