![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
flushable-set
Advanced tools
A drop-in replacement of the native Set with an optional max size and a flush callback.
A drop-in replacement of the native Set with an optional max size and a flush callback.
import { FlushableSet } from "@vicary/flushable-set";
const set = new FlushableSet(null, {
maxSize: 3,
onFlush() {
console.log("Flushing items", Array.from(this));
},
});
for (let i = 0; i < 10; i++) {
set.add(i);
}
// Flushing items [0, 1, 2]
// Flushing items [3, 4, 5]
// Flushing items [6, 7, 8]
// Flushing items [9]
Asynchronous flush is supported with promise mutex, this comes in handy for database insertion from an external stream.
const chunk = new FlushableSet(null, {
maxSize: 100,
async onFlush() {
await db.insertMany(Array.from(this));
},
});
for await (const row of dataStream) {
// Automatically flushes to database for every 100 rows
await chunk.addAsync(row);
}
// Flush the remaining items
await chunk.flush();
If you find a bug or would like to suggest a new feature, please open an issue or submit a pull request on GitHub.
FlushableSet is licensed under the MIT License. See the LICENSE file for more information.
If you find this project useful, please consider supporting it by donating to the author.
FAQs
A drop-in replacement of the native Set with an optional max size and a flush callback.
We found that flushable-set demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.