
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
newsemitter
Advanced tools
An event emitter that emits only new events. Because sometimes we don't care about old events.
const NewsEmitter = require('newsemitter');
const news = new NewsEmitter();
news.on('item', (item) => {
console.log('new item:', item.title);
});
news.emit('item', { title: 'hello there' });
news.emit('item', { title: 'hello world' });
news.emit('item', { title: 'hello there' });
news.emit('item', { title: 'hey' });
news.emit('item', { title: 'hey' });
news.emit('item', { title: 'hey' });
// new item: hello there
// new item: hello world
// new item: hey
Creates an instance of a NewsEmitter. options
can be
filter
- An array of events that will be affected. If not given, event names will not be filtered.ignore
- An array of events that will be ignored. Defaults to ['newListener', 'removeListener']
.maxHistory
- Maximum number of history items to remember. Default is 10
.manageHistory
- If true, does not add emitted events to history. Instead expects you to manually manage history with addHistory()
. Defaults to false
.identifier
- Function used to compare one event to another. Called with a list of arguments that NewsEmitter#emit()
is called with, sans event name. Should return a string. Default is JSON.stringify
.Emits an event, only if it has not been emitted before. Returns true if item is new and emtted. False otherwise.
Resets history of an event. If no event given, resets all history.
Adds items in arr
as event
's history. Truncated as necessary based on max history length considering the last item in the array as newest.
npm install newsemitter
Tests are written with mocha
npm test
FAQs
An event emitter that emits only new events.
We found that newsemitter 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.