'Convert GUID to 8-4-4-4-12 format in javascript [duplicate]

I am looking to convert a GUID such as 18d874986a114520bd29466a446a50eb to the format 18d87498-6a11-4520-bd29-466a446a50eb

Is there a function in Javascript for doing this?

I googled a bit and looks like the 8-4-4-4-12 format is called UUID. I however, do not find any to UUID conversion libraries.

Do I need to write my own?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source