question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add fromString method alternative

See original GitHub issue

I’d like to migrate from uuidv4, as suggested in that repo. I’m using the function fromString which doesn’t exist in this repo. I see the uuid.v4() function accepts several options, but I don’t see a way to create a uuid given a string. Could you provide this functionality or document it if already available?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
broofacommented, Sep 24, 2020

@correttojs The deprecation message warning provided by uuidv4 tells you (mostly) how to do this - use the v5() method. E.g.

import {v5 as uuidv5} from 'uuid';

uuidv5('string to create uuid from', 'bb5d0ffa-9a4c-4d7c-8fc2-0a7d2220ba45');

(@ctavan: uuidv4’s fromString() method is a wrapper around v5 namespace uuid creation. See source.)

The one fiddly bit is the custom namespace (“bb5d0ffa-…”) you need to provide if you care about backward compatibility with previously generated fromString() ids. Otherwise you can use uuidv5.DNS or uuidv5.URL instead, or create your own namespace id as described in our docs.

Cc: @goloroden for possible improvements to deprecation / migration instructions in uuidv4 codebase.

0reactions
ctavancommented, Oct 4, 2020

Closing in favor of https://github.com/thenativeweb/uuidv4/issues/219 since there’s nothing actionable on our end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

json - Return a javascript object from string using Regex or ...
I have a function in Javascript to match text between curly braces (including the braces) in order to extract a JSON string from...
Read more >
java.util.UUID.fromString java code examples - Tabnine
Parses a UUID string with the format defined by #toString(). Popular methods of UUID. randomUUID. Generates a variant 2, version 4 (randomly generated...
Read more >
String - JavaScript - MDN Web Docs
The localeCompare() method enables string comparison in a similar fashion as strcmp() — it allows sorting strings in a locale-aware manner.
Read more >
Python String Methods | Set 3 (strip, lstrip, rstrip, min, max ...
Some of the string methods are covered in the below sets. ... max(“string”) :- This function returns the maximum value alphabet from string....
Read more >
How to remove a character from a string in Python? - Flexiple
Methods to remove character from string in Python ... multiple characters from a string, you can add all the characters to an iterable, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found