Created
January 19, 2018 00:24
-
-
Save mspclaims/24273136d3081436083e187712d40fe3 to your computer and use it in GitHub Desktop.
reformat UUID which had dashes stripped out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.restoreUUID = function(id){ | |
if (id.length != 32) return id; | |
let template = "8-4-4-4-12";//using string to provide guid template | |
let offset = 0; | |
return template | |
.split("-") | |
.map(length => { | |
let part = id.substr(offset,length); | |
offset += parseInt(length); | |
return part; | |
}) | |
.join("-"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment