fast-unique-numbers
A module to create a set of unique numbers as fast as possible.
Last updated 14 days ago by chrisguttandin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install fast-unique-numbers 
SYNC missed versions from official npm registry.

fast-unique-numbers

A module to create a set of unique numbers as fast as possible.

version

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.

Usage

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.

addUniqueNumber()

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 }

generateUniqueNumber()

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

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Current Tags

  • 9.0.14                                ...           latest (14 days ago)

148 Versions

  • 9.0.14                                ...           14 days ago
  • 9.0.13                                ...           21 days ago
  • 9.0.12                                ...           22 days ago
  • 9.0.11                                ...           a month ago
  • 9.0.10                                ...           a month ago
  • 9.0.9                                ...           2 months ago
  • 9.0.8                                ...           3 months ago
  • 9.0.7                                ...           4 months ago
  • 9.0.6                                ...           4 months ago
  • 9.0.5                                ...           6 months ago
  • 9.0.4                                ...           7 months ago
  • 9.0.3                                ...           8 months ago
  • 9.0.2                                ...           8 months ago
  • 9.0.1                                ...           8 months ago
  • 9.0.0                                ...           9 months ago
  • 8.0.13                                ...           10 months ago
  • 8.0.12                                ...           a year ago
  • 8.0.11                                ...           a year ago
  • 8.0.10                                ...           a year ago
  • 8.0.9                                ...           a year ago
  • 8.0.8                                ...           a year ago
  • 8.0.7                                ...           a year ago
  • 8.0.6                                ...           a year ago
  • 8.0.5                                ...           a year ago
  • 8.0.4                                ...           a year ago
  • 8.0.3                                ...           a year ago
  • 8.0.2                                ...           a year ago
  • 8.0.1                                ...           2 years ago
  • 8.0.0                                ...           2 years ago
  • 7.0.2                                ...           2 years ago
  • 7.0.1                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 6.0.25                                ...           2 years ago
  • 6.0.24                                ...           2 years ago
  • 6.0.23                                ...           2 years ago
  • 6.0.22                                ...           2 years ago
  • 6.0.21                                ...           2 years ago
  • 6.0.20                                ...           2 years ago
  • 6.0.19                                ...           2 years ago
  • 6.0.18                                ...           2 years ago
  • 6.0.17                                ...           2 years ago
  • 6.0.16                                ...           2 years ago
  • 6.0.15                                ...           3 years ago
  • 6.0.14                                ...           3 years ago
  • 6.0.13                                ...           3 years ago
  • 6.0.12                                ...           3 years ago
  • 6.0.11                                ...           3 years ago
  • 6.0.10                                ...           3 years ago
  • 6.0.9                                ...           3 years ago
  • 6.0.8                                ...           3 years ago
  • 6.0.7                                ...           3 years ago
  • 6.0.6                                ...           3 years ago
  • 6.0.5                                ...           3 years ago
  • 6.0.4                                ...           3 years ago
  • 6.0.3                                ...           3 years ago
  • 6.0.2                                ...           3 years ago
  • 6.0.1                                ...           4 years ago
  • 6.0.0                                ...           4 years ago
  • 5.0.35                                ...           4 years ago
  • 5.0.34                                ...           4 years ago
  • 5.0.33                                ...           4 years ago
  • 5.0.32                                ...           4 years ago
  • 5.0.31                                ...           4 years ago
  • 5.0.30                                ...           4 years ago
  • 5.0.29                                ...           4 years ago
  • 5.0.28                                ...           4 years ago
  • 5.0.27                                ...           4 years ago
  • 5.0.26                                ...           4 years ago
  • 5.0.25                                ...           4 years ago
  • 5.0.24                                ...           4 years ago
  • 5.0.23                                ...           4 years ago
  • 5.0.22                                ...           4 years ago
  • 5.0.21                                ...           4 years ago
  • 5.0.20                                ...           4 years ago
  • 5.0.19                                ...           4 years ago
  • 5.0.18                                ...           4 years ago
  • 5.0.17                                ...           4 years ago
  • 5.0.16                                ...           4 years ago
  • 5.0.15                                ...           4 years ago
  • 5.0.14                                ...           4 years ago
  • 5.0.13                                ...           4 years ago
  • 5.0.12                                ...           4 years ago
  • 5.0.11                                ...           4 years ago
  • 5.0.10                                ...           4 years ago
  • 5.0.9                                ...           4 years ago
  • 5.0.8                                ...           4 years ago
  • 5.0.7                                ...           5 years ago
  • 5.0.6                                ...           5 years ago
  • 5.0.5                                ...           5 years ago
  • 5.0.4                                ...           5 years ago
  • 5.0.3                                ...           5 years ago
  • 5.0.2                                ...           5 years ago
  • 5.0.1                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.0.21                                ...           5 years ago
  • 4.0.20                                ...           5 years ago
  • 4.0.19                                ...           5 years ago
  • 4.0.18                                ...           5 years ago
  • 4.0.17                                ...           5 years ago
  • 4.0.16                                ...           5 years ago
  • 4.0.15                                ...           5 years ago
  • 4.0.14                                ...           5 years ago
  • 4.0.13                                ...           5 years ago
  • 4.0.12                                ...           5 years ago
  • 4.0.11                                ...           5 years ago
  • 4.0.10                                ...           5 years ago
  • 4.0.9                                ...           5 years ago
  • 4.0.8                                ...           5 years ago
  • 4.0.7                                ...           5 years ago
  • 4.0.6                                ...           5 years ago
  • 4.0.5                                ...           5 years ago
  • 4.0.4                                ...           5 years ago
  • 4.0.3                                ...           5 years ago
  • 4.0.2                                ...           5 years ago
  • 4.0.1                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.0.12                                ...           5 years ago
  • 3.0.11                                ...           6 years ago
  • 3.0.10                                ...           6 years ago
  • 3.0.9                                ...           6 years ago
  • 3.0.8                                ...           6 years ago
  • 3.0.7                                ...           6 years ago
  • 3.0.6                                ...           6 years ago
  • 3.0.5                                ...           6 years ago
  • 3.0.4                                ...           6 years ago
  • 3.0.3                                ...           6 years ago
  • 3.0.2                                ...           6 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.1.5                                ...           6 years ago
  • 2.1.4                                ...           6 years ago
  • 2.1.3                                ...           6 years ago
  • 2.1.2                                ...           6 years ago
  • 2.1.1                                ...           6 years ago
  • 2.1.0                                ...           6 years ago
  • 2.0.4                                ...           6 years ago
  • 2.0.3                                ...           6 years ago
  • 2.0.2                                ...           6 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.1.5                                ...           7 years ago
  • 1.1.4                                ...           7 years ago
  • 1.1.3                                ...           7 years ago
  • 1.1.2                                ...           7 years ago
  • 1.1.1                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE