Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function MakeConvertor(toAlphabet) {
// Default to Flickr 58
var useAlphabet = toAlphabet || flickrBase58;
// UUIDs are in hex, so we translate to and from.
var fromHex = anyBase(anyBase.HEX, useAlphabet);
var toHex = anyBase(useAlphabet, anyBase.HEX);
return {
new: function() { return shortenUUID(uuidV4(), fromHex); },
uuid: uuidV4,
fromUUID: function(uuid) { return shortenUUID(uuid, fromHex); },
toUUID: function(shortUuid) { return enlargeUUID(shortUuid, toHex); },
alphabet: useAlphabet
};
}
function MakeConvertor(toAlphabet) {
// Default to Flickr 58
var useAlphabet = toAlphabet || flickrBase58;
// UUIDs are in hex, so we translate to and from.
var fromHex = anyBase(anyBase.HEX, useAlphabet);
var toHex = anyBase(useAlphabet, anyBase.HEX);
return {
new: function() { return shortenUUID(uuidV4(), fromHex); },
uuid: uuidV4,
fromUUID: function(uuid) { return shortenUUID(uuid, fromHex); },
toUUID: function(shortUuid) { return enlargeUUID(shortUuid, toHex); },
alphabet: useAlphabet
};
}