Comparing version 4.2.13 to 5.0.0
@@ -1,16 +0,16 @@ | ||
const UUID = require("uuidjs") | ||
import { UUID } from "uuidjs"; | ||
// Generate UUID string | ||
console.log(UUID.generate()) | ||
console.log(UUID.generate()); | ||
// Create UUID objects and get string representations | ||
console.log(UUID.genV4().toString()) | ||
console.log(UUID.genV1().hexNoDelim) | ||
console.log(UUID.parse("84d9ca79-4d66-4373-91a0-a12d673e71be").urn) | ||
console.log(UUID.genV4().toString()); | ||
console.log(UUID.genV1().hexNoDelim); | ||
console.log(UUID.parse("84d9ca79-4d66-4373-91a0-a12d673e71be").urn); | ||
// Get UUID internal field values | ||
console.log(UUID.genV4().hexFields.node) | ||
console.log(UUID.genV1().intFields.timeLow) | ||
console.log(UUID.genV4().bitFields[2]) | ||
console.log(UUID.genV4().hexFields.node); | ||
console.log(UUID.genV1().intFields.timeLow); | ||
console.log(UUID.genV4().bitFields[2]); | ||
UUID.genV1() | ||
UUID.genV1(); |
{ | ||
"name": "uuidjs", | ||
"version": "4.2.13", | ||
"version": "5.0.0", | ||
"title": "UUID.js", | ||
"description": "RFC-compliant UUID Generator for JavaScript", | ||
"main": "src/uuid.js", | ||
"types": "types/uuidjs/index.d.ts", | ||
"type": "module", | ||
"main": "dist/uuid.js", | ||
"exports": "./dist/uuid.js", | ||
"types": "./dist/uuid.d.ts", | ||
"bin": { | ||
"uuidjs": "bin/cli.js" | ||
"uuidjs": "./dist/cli.js" | ||
}, | ||
"directories": { | ||
"bin": "bin", | ||
"test": "test" | ||
}, | ||
"files": [ | ||
"dist", | ||
"example.js" | ||
], | ||
"sideEffects": false, | ||
"runkitExampleFilename": "example.js", | ||
"scripts": { | ||
"jsdoc": "rm -rf docs && jsdoc -R README.md -d docs src/uuid.js", | ||
"prepare": "npm run test && npm run test-ts", | ||
"test": "qunit test/nodejs.js", | ||
"test-ts": "tsc --strict --noEmit types/*.ts" | ||
"build": "rm -rf ./dist && tsc", | ||
"doc": "rm -rf ./docs && typedoc ./src/uuid.ts --gitRevision \"v$npm_package_version\"", | ||
"prepare": "npm run build && npm run test && npm run doc", | ||
"test": "qunit ./test/index.js" | ||
}, | ||
@@ -44,9 +47,6 @@ "repository": { | ||
"devDependencies": { | ||
"jsdoc": "^4.0.0", | ||
"qunit": "^2.19.3", | ||
"qunit": "^2.19.4", | ||
"typedoc": "^0.23.24", | ||
"typescript": "^4.9.4" | ||
}, | ||
"browser": { | ||
"crypto": false | ||
} | ||
} |
@@ -10,4 +10,6 @@ # UUID.js - RFC-compliant UUID Generator for JavaScript | ||
<!-- HTML5 --> | ||
<script src="src/uuid.js"></script> | ||
<script> var uuid = UUID.generate(); </script> | ||
<script type="module"> | ||
import { UUID } from "https://unpkg.com/uuidjs@^5"; | ||
const uuid = UUID.generate(); | ||
</script> | ||
``` | ||
@@ -17,4 +19,4 @@ | ||
// Node.js | ||
let UUID = require("uuidjs"); | ||
let uuid = UUID.generate(); | ||
import { UUID } from "uuidjs"; | ||
const uuid = UUID.generate(); | ||
``` | ||
@@ -24,5 +26,5 @@ | ||
// TypeScript | ||
import UUID from "uuidjs"; | ||
let str: string = UUID.generate(); | ||
let obj: UUID = UUID.genV4(); | ||
import { UUID } from "uuidjs"; | ||
const str: string = UUID.generate(); | ||
const obj: UUID = UUID.genV4(); | ||
``` | ||
@@ -55,23 +57,13 @@ | ||
to maintain a high-quality code base | ||
- Supports old browsers as well as modern browser and server environments, as | ||
kept compatible with ECMAScript 3rd edition | ||
## Install | ||
## Usage Examples | ||
Download `src/uuid.js` or call `npm install uuidjs`. | ||
Import `UUID` class: | ||
Then, load `src/uuid.js`. | ||
```html | ||
<script src="src/uuid.js"></script> | ||
``` | ||
Or, import `uuidjs`. | ||
```javascript | ||
const UUID = require("uuidjs"); | ||
import { UUID } from "uuidjs"; | ||
// or on browsers: | ||
// import { UUID } from "https://unpkg.com/uuidjs@^5"; | ||
``` | ||
## Usage Examples | ||
`UUID.generate()` returns a version 4 UUID as a hexadecimal string. | ||
@@ -89,9 +81,9 @@ | ||
// Create a version 4 (random number-based) UUID object | ||
var objV4 = UUID.genV4(); | ||
const objV4 = UUID.genV4(); | ||
// Create a version 1 (time-based) UUID object | ||
var objV1 = UUID.genV1(); | ||
const objV1 = UUID.genV1(); | ||
// Create a UUID object from a hexadecimal string | ||
var uuid = UUID.parse("a0e0f130-8c21-11df-92d9-95795a3bcd40"); | ||
const uuid = UUID.parse("a0e0f130-8c21-11df-92d9-95795a3bcd40"); | ||
@@ -128,12 +120,2 @@ // Get string representations of a UUID object | ||
UUID.js supports the so-called noConflict mode to work around namespace | ||
conflicts. | ||
```javascript | ||
// Avoid namespace conflicts with other libraries | ||
var arbitraryVarName = UUID; | ||
UUID = UUID.overwrittenUUID; // Restore the original value | ||
console.log(arbitraryVarName.generate()); // "cb9a0283-a44c-4e7a-a5b0-9cd2876e952b" | ||
``` | ||
## License | ||
@@ -164,2 +146,2 @@ | ||
- [API Documentation](https://liosk.github.io/UUID.js/docs/) | ||
- [Run test cases on your browser](https://liosk.github.io/UUID.js/test/browser.html) | ||
- [Run test cases on your browser](https://liosk.github.io/UUID.js/test/) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
Yes
34016
8
521
141