Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
asyncreiterable
Advanced tools
An AsyncReiterable is an append-only collection that allows multiple asynchronous iterations.
An AsyncReiterable
is an append-only collection that allows multiple asynchronous iterations.
Each time the iterator()
method of this AsyncReiterable
is called,
a new AsyncIterator is produced.
This package can be used in cases where you need an AsyncIterator, but you need to be able to iterate over them multiple times.
$ npm install asyncreiterable
At the time of writing, this package provides AsyncReiterableArray
,
an array-backed implementation of the AsyncReiterable
interface.
It can be constructed in different ways through the following static methods:
import {AsyncReiterableArray} from "asyncreiterable";
# Creates an ended AsyncReiterable with the given data elements
AsyncReiterableArray.fromFixedData([1, 2, 3])
# Creates an open-ended AsyncReiterable with the given initial data elements
AsyncReiterableArray.fromInitialData([1, 2, 3])
# Creates an open-ended AsyncReiterable with no initial data elements
AsyncReiterableArray.fromInitialEmpty()
Data elements can only be pushed, no data elements can be removed.
The iterable becomes ended when null
is pushed.
const iterable = AsyncReiterableArray.fromInitialData([1, 2, 3])
# Add data elements
iterable.push(4);
iterable.push(5);
iterable.push(6);
# End the iterable
iterable.push(null);
AsyncReiterable
that are either ended or not ended yet can both be iterated.
The iterator()
method returns an AsyncIterator
that will contains all current and future data elements in this AsyncReiterable
.
It will be ended once the AsyncReiterable
is ended.
const iterable = AsyncReiterableArray.fromInitialData([1, 2])
const it1 = iterable.iterator();
const it2 = iterable.iterator();
it1.on('data', console.log);
it2.on('data', console.log);
iterable.push(3);
iterable.push(4);
iterable.push(null);
# Output from both iterators:
# 1
# 2
# 3
# 4
This software is written by Ruben Taelman.
This code is released under the MIT license.
FAQs
An AsyncReiterable is an append-only collection that allows multiple asynchronous iterations.
We found that asyncreiterable 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.