Gathering detailed insights and metrics for uniqid
Gathering detailed insights and metrics for uniqid
Gathering detailed insights and metrics for uniqid
Gathering detailed insights and metrics for uniqid
npm install uniqid
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
616 Stars
66 Commits
49 Forks
14 Watching
6 Branches
15 Contributors
Updated on 18 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
4.6%
127,310
Compared to previous day
Last week
12.3%
711,560
Compared to previous week
Last month
20.2%
2,599,084
Compared to previous month
Last year
19.7%
25,204,879
Compared to previous year
It will always create unique id's based on the current time, process and machine name.
1// install with npm 2npm install uniqid 3 4// install with yarn 5yarn add uniqid
1import uniqid from 'uniqid'; 2 3console.log(uniqid()); // -> 4n5pxq24kpiob12og9 4console.log(uniqid(), uniqid()); // -> 4n5pxq24kriob12ogd, 4n5pxq24ksiob12ogl
1var uniqid = require('uniqid'); 2 3console.log(uniqid()); // -> 4n5pxq24kpiob12og9 4console.log(uniqid(), uniqid()); // -> 4n5pxq24kriob12ogd, 4n5pxq24ksiob12ogl
Take advantage of content delivery networks for Prototyping/Mockups
1<!DOCTYPE html> 2<html lang="en"> 3 4<head> 5 <script src="https://unpkg.com/browse/uniqid@5.5.0/UMD/uniqid.min.js"></script> 6 <script> 7 alert(`Here is an ID: ${uniqid()}`) 8 </script> 9 10 <title>Your App</title> 11</head> 12 13<body> 14 15</body> 16 17</html>
Generate 18 byte unique id's based on the time, process id and mac address. Works on multiple processes and machines.
1uniqid() -> "4n5pxq24kpiob12og9" 2uniqid('hello-') -> "hello-4n5pxq24kpiob12og9" 3uniqid('hello-', '-goodbye') -> "hello-4n5pxq24kpiob12og9-goodbye" 4 5// usage with suffix only 6uniqid('', '-goodbye') -> "4n5pxq24kpiob12og9-goodbye" 7uniqid(undefined, '-goodbye') -> "4n5pxq24kpiob12og9-goodbye"
Generate 12 byte unique id's based on the time and the process id. Works on multiple processes within a single machine but not on multiple machines.
1uniqid.process() -> "24ieiob0te82"
Generate 8 byte unique id's based on the current time only. Recommended only on a single process on a single machine.
1uniqid.time() -> "iob0ucoj"
Since browsers don't provide a Process ID and in most cases neither give a Mac Address using uniqid from Webpack, Browserify and Vite falls back to uniqid.time()
for all the other methods too. The browser is the single process, single machine case anyway.
Debug messages are turned off by default as of v4.1.0
. To turn on debug messages you'll need to set uniqid_debug
to true
before you require the module.
1// enable debug messages 2module.uniqid_debug = true; 3 4// require the module 5var uniqid = require('uniqid');
(The MIT License)
Copyright (c) 2014-2021 Halász Ádám adam@aimform.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 7/22 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More