thenativeweb / uuidv4 Goto Github PK
View Code? Open in Web Editor NEWuuidv4 creates v4 UUIDs.
License: MIT License
uuidv4 creates v4 UUIDs.
License: MIT License
I've just moved from 6.1.1 to 6.2.5 and now v3 UUIDs such as a3bb189e-8bf9-3888-9912-ace4e6543002
are passing as valid.
Package not converted to ES5 ( we support the ES5
Code:
const { uuid } = require('uuidv4')
console.log(uuid)
Output:
[Function: deprecated]
Why deprecated
?
The function fromString as found here: https://github.com/thenativeweb/uuidv4/blob/master/src/uuidv4.js#L24 is unfortunately fundamentally flawed and not up to RFC specifications.
A UUID v4 is supposed to be a cryptographically random generated UUID. fromString makes that entire specification moot and generates a UUID based of a string by cutting pieces the now deprecated sha1 hash, and due to UUID limitations, it can't use all of its 40 characters, opening up for further collisions.
converting my project to angular 10, now I get this warning
component.ts depends on uuidv4. CommonJS or AMD dependencies can cause optimization bailouts.
I am importing like this
import { uuid } from 'uuidv4';
how can I remove this warning ?
Hi,
For some reason I notice that the uuids that are generated will repeat after a while. Is this natural to uuidv4 or is this an implementation problem?
The same results happen when run on nodejs v9.2.0 and v10.1.0. I have not tested this with other nodejs versions.
// Script
const uuid = require('uuidv4')
for (let i=0; i < 100000000000; i++) {
let str = uuid()
if (/^cacaca/g.test(str)) {
console.log(new Date(), str)
}
}
// Output
2018-06-11T14:01:17.878Z 'cacacab3-022d-48c8-9d9d-f05c42b5862a'
2018-06-11T14:02:35.680Z 'cacaca76-f041-4fcb-8ea1-3976147376c3'
2018-06-11T14:02:37.495Z 'cacaca07-b648-4ef2-9159-afa88c6a80f2'
2018-06-11T14:03:01.127Z 'cacacab3-022d-48c8-9d9d-f05c42b5862a'
I installed using $ npm i --save uuidv4
. My test:
const { uuid } = require('uuidv4');
const my_uuid = uuid();
console.log(my_uuid);
Output:
$ 3e394565-2f03-4cc6-a7d2-0d1f844138bf
$ (node:76250) DeprecationWarning: uuidv4() is deprecated. Use v4() from the uuid module instead.
$ (Use `node --trace-deprecation ...` to show where the warning was created)
Hi! I'm one of the maintainers of the uuid
module which is used as a dependency under the hood of this module.
I was made aware of this module due to a bug report (uuidjs/uuid#488) which ended up in the wrong repository.
With the upcoming [email protected]
release we will be adding parse
/stringify
/validate
/version
methods as well as a NIL
constant. So I was wondering what the remaining differences to this module would then still be? (Maybe JSON Schema?)
I just realized that many of the recent bug reports in this repo were actually just manifestations of upstream bugs, so maybe it would reduce overall maintenance burden if we simply merged the two modules together? BTW this has happened a few years ago already when we merged node-uuid
and uuid
into one module.
In any case I just wanted to let you know that we're always open for contributions at https://github.com/uuidjs/uuid If there is no interest from your end to consolidate the efforts then please just close this issue.
strange deps : https://www.npmjs.com/package/uuidv4
which packge should i choose?
Somewhere between version 6.1.0 and 6.2.4 isUuid
was replaced by validate
from uuid
package.
However, the two functions are not equivalent.
Previous implementation of isUuid
was validating that the 14th character was a '4' since this is a must for a valid uuid V4.
Implementation of validate
does not do this check causing a backward incompatible change.
Maybe something to fix in uuid
package ?
Getting error:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
- install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "util": false }
This is using uuidv4 on nx workspaces.
(node:61134) DeprecationWarning: uuidv4() is deprecated. Use v4() from the uuid module instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
No idea what I am doing wrong here. I installed uuivv4
and it shows up in my package.json under dependencies: "uuidv4": "^6.2.6"
.
So in my NodeJS code, I import it and attempt to use it like so:
import uuid from 'uuidv4';
...
const clientID = uuid();
And I get the error: TypeError: uuid is not a function
On IE, the /u modifier is not supported, as discussed here:
https://stackoverflow.com/questions/59102986/uuidv4-js-regular-expression-issue-ie11
I am not sure of the way around this. Any suggestions?
Hi@all,
I have a error with the version 6.2.4:
error: Error: Unable to resolve module `util` from `node_modules/uuidv4/build/lib/uuidv4.js`: util could not be found within the project.
I switched back to 6.1.1, that works fine.
Is that id Globally Unique in distributed architecture?
I could not import this module for Node 13.5 or 13.6. It works on 13.7, 13.4 and 12.10.
Since 13.7 is already out, you might not care, so go ahead and close this. I'm reporting for posterity at least.
6.0.7 is the last version that works for me.
On 6.0.8 - 6.1.1 it throws:
internal/modules/cjs/loader.js:625
throw e;
^
Error: No valid exports main found for '...\node_modules\uuidv4\node_modules\uuid'
at resolveExportsTarget (internal/modules/cjs/loader.js:622:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:654:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (...\node_modules\uuidv4\build\lib\uuidv4.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1139:30) {
code: 'MODULE_NOT_FOUND'
}
On 6.1.1 - 6.2.0 it throws:
...\node_modules\uuidv4\node_modules\uuid\dist\esm-browser\index.js:1
export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1055:16)
at Module._compile (internal/modules/cjs/loader.js:1103:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
at Module.load (internal/modules/cjs/loader.js:988:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (...\node_modules\uuidv4\build\lib\uuidv4.js:4:16)
at Module._compile (internal/modules/cjs/loader.js:1139:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
uuidv4
stops working on release builds of react-native.
The error occurs because crypto.getRandomValues
is not provided out of the box in react-native in release mode.
When in debug mode it works since Chrome debugger comes with crypto.getRandomValues
.
Reference issue: uuidjs/uuid#375
Just referencing uuidjs/uuid#520 (comment) here so it doesn't get lost.
uuidv4() is deprecated. Use v4() from the uuid module instead...wtf?
Just switched over for the 90% size reduction from the plain UUID package, so thank you for giving us a great, slim package to use!
May be an edge case here, but the places my project uses uuid
it is often putting that into an object by doing something like:
...
const uuid = uuidv4();
return { uuid, data };
With the current export signature of this module I either have to do some hacky things or change everywhere that I use uuids to nolonger use uuid
as my own variable.
See PR here
const { uuid } = require('uuidv4');
throws error: 'MODULE_NOT_FOUND' if installed at latest version npm i uuidv4
but works fine with npm i [email protected]
Hi,
I just upgraded to the latest uuidv4, and ran into trouble when using it. After looking through the changeset, I see that you no longer have a default export. Is there a reason that the default export was removed? I'm working with a large codebase, and I'd like to keep things up to date with the latest version, but I'd have to change a very large number of files to refactor to use the named exports.
Thanks
Steps:
nan-undefinedundefined-undefinedundefined-undefinedundefined-undefinedundefinedundefinedundefinedundefinedundefined
Pretty much title. When running with yarn install
, yarn can't find uuid v3.3.3 and asks to downgrade to 3.3.2, which is fine.
Running with npm install
though it fails, because npm can't find uuid3.3.3 which is listed as a dependency of uuidv4.
Seems like the additions of uuid v5 crashed compatibility with expo and maybe even react-native, the error message:
The package at "node_modules/uuidv4/node_modules/uuid/v5.js" attempted to import the Node standard library module "util". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq/#can-i-use-nodejs-packages-with-expo
Building JavaScript bundle: error
This error occurred after I updated from 6.0.2 to version 6.0.5.
here is a correct v4 regex
/^[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/i;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.