Gathering detailed insights and metrics for uuid-tool
Gathering detailed insights and metrics for uuid-tool
Gathering detailed insights and metrics for uuid-tool
Gathering detailed insights and metrics for uuid-tool
UUID for JavaScript and TypeScript. Parse, generate, compare, validate and convert.
npm install uuid-tool
Typescript
Module System
Node Version
NPM Version
74
Supply Chain
100
Quality
75.7
Maintenance
100
Vulnerability
100
License
TypeScript (91.41%)
JavaScript (8.59%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
27 Commits
1 Forks
2 Branches
1 Contributors
Updated on May 15, 2024
Latest Version
2.0.3
Package Id
uuid-tool@2.0.3
Unpacked Size
14.50 kB
Size
4.98 kB
File Count
8
NPM Version
6.14.10
Node Version
14.15.4
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Lightweight UUID library for JavaScript, written in TypeScript. (Types declarations included.) Simple to use, simply works. Well tested and no dependencies. For NodeJS and Browser.
Parse and generate UUIDs. Convert between UUID string (36 byte) to 16 byte array. UUID RFC 4122 Version 4
1npm i uuid-tool
1let uuid = UuidTool.newUuid();
2let bytes = UuidTool.toBytes(uuid);
3let strAgain = UuidTool.toString(bytes);
4let isValid = UuidTool.isUuid(strAgain);
5let isEqual = UuidTool.compare(uuid1, uuid2);
You can also use the Uuid
class.
1let uuid = new Uuid(byteOrString);
2let str = uuid.toString();
3let bytes = uuid.toBytes();
1// Generate a new UUID 2let uuid = new Uuid();
1// Compare (case insensitive) 2let uuid1 = new Uuid('3C09B262-49C7-466F-8B4F-626BCA1EC9BC'); 3let uuid2 = new Uuid('3c09b262-49c7-466f-8b4f-626bca1ec9bc'); 4 5if (uuid1.equals(uuid2)) { 6 console.log('The IDs match.'); 7} else { 8 console.log('The IDs do not match.'); 9} 10 11// Result: The IDs match.
In NodeJS e.g.
1const Uuid = require('uuid-tool').Uuid; 2console.log(new Uuid().toString());
From Json:
1const jsonStr = '{ "id": "3c09b262-49c7-466f-8b4f-626bca1ec9bc" }'; 2const uuid = Uuid.fromJson(jsonStr); 3// or as already parsed json object: 4const jsonObj = { id: '3c09b262-49c7-466f-8b4f-626bca1ec9bc' }; 5const uuid = Uuid.fromJson(jsonObj); 6// otherwise it throws an error on invalid inputs.
Converts an UUID string to an UUID byte array.
Param | Type | Description |
---|---|---|
uuid | string | UUID string e.g. '1FBD384C-B2A1-41C6-84AF-43CABDF44124' |
Returns number[]
UUID byte array (length: 16)
Converts an UUID byte array to an UUID string.
Param | Type | Description |
---|---|---|
bytes | number[] | UUID Byte array (length 16 bytes of bytes) |
Returns string
UUID string. (length 36)
Generates a new (pseudo) UUID RFC 4122 Version 4.
Returns string
UUID e.g. '1FBD384C-B2A1-41C6-84AF-43CABDF44124'
Converts an UUID byte array to an UUID string.
Param | Type | Description |
---|---|---|
uuid | string | UUID string e.g. '1FBD384C-B2A1-41C6-84AF-43CABDF44124' |
Returns boolean
True if valid, otherwise false.
Compares two UUIDs.
Param | Type | Description |
---|---|---|
uuid1 | string | UUID string |
uuid2 | string | UUID string |
Returns boolean
True if equal, otherwise false.
Re-generates a new UUID for this instance.
Returns this
The same UUID instance.
Converts an UUID byte array to an UUID string. (length: 36)
Note that the internal UUID has not yet been validated. Use the method isValid
.
Param | Type | Description |
---|---|---|
bytes | number[] | UUID Byte array (length 16 bytes of bytes) |
Returns this
The same UUID instance.
Converts this UUID to an UUID byte array. (length: 16)
Returns number[]
The UUID as byte array.
Converts an UUID byte array to an UUID string. (length: 36)
Note that the internal UUID has not yet been validated. Use the method isValid
.
Param | Type | Description |
---|---|---|
uuid | string | string e.g. '1FBD384C-B2A1-41C6-84AF-43CABDF44124' |
Returns this
The same UUID instance.
To UUID string. HINT Set case mode by Uuid.stringExportFormat = 'uppercase' | 'lowercase'; This also affects the result of JSON.stringify(...);
Returns string
UUID string e.g. '1FBD384C-B2A1-41C6-84AF-43CABDF44124'
Validate this UUID.
Returns boolean
True if valid, otherwise false.
Compares this UUID with another UUID.
Param | Type | Description |
---|---|---|
uuid | Uuid | string | Another UUID instance or uuid-string. |
Returns boolean
True if equal, otherwise false.
Converts the JSON representation of this class to this class.
Param | Type | Description |
---|---|---|
uuid | UuidLike | string | The string representation of this class. |
Returns Uuid
The Uuid
class with the parsed input object.
MIT © Copyright 2018 - 2021 Dominik-Andreas Geng (@domske)
UUID logo © Copyright 2021 Dominik Geng
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
security policy file not detected
Details
Reason
project is not fuzzed
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
40 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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