![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.
fast-unique-numbers
Advanced tools
A module to create a set of unique numbers as fast as possible.
A module to create a set of unique numbers as fast as possible.
This module is meant to create unique numbers within a given Map or Set. To achieve that as fast as possible the resulting set of numbers will only contain integers. Additionally only small integers will be used for as long as possible. Small integers can be stored more efficiently by JavaScript engines like SpiderMonkey or V8.
To verify the expected perfomance benefit an expectation test is used to make sure small integers do actually perform better in Chromium based browsers, Firefox and when using Node.js.
This module is available on npm and can be installed by running the following command:
npm install fast-unique-numbers
This module exports two functions.
This function takes a Set
of numbers as argument and appends a new unique number to it. It also returns that number.
import { addUniqueNumber } from 'fast-unique-numbers';
const set = new Set([1, 4, 8]);
const uniqueNumber = addUniqueNumber(set);
console.log(uniqueNumber); // 3
console.log(set); // Set(4) { 1, 4, 8, 3 }
This function can be used to generate a unique number which is not yet present in the given Set
or is no key in the given Map
. The resulting number gets not appended. It only gets returned.
import { generateUniqueNumber } from 'fast-unique-numbers';
const map = new Map([
[1, 'something'],
[4, 'something else']
]);
const uniqueNumber = generateUniqueNumber(map);
console.log(uniqueNumber); // 2
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
FAQs
A module to create a set of unique numbers as fast as possible.
The npm package fast-unique-numbers receives a total of 369,858 weekly downloads. As such, fast-unique-numbers popularity was classified as popular.
We found that fast-unique-numbers demonstrated a healthy version release cadence and project activity because the last version was released less than 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
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.