1
0
Fork 0
mirror of synced 2024-09-18 18:28:33 +12:00
budibase/packages/builder/src/builderStore/uuid.js

10 lines
339 B
JavaScript
Raw Normal View History

export function uuid() {
2020-08-07 08:12:35 +12:00
// always want to make this start with a letter, as this makes it
// easier to use with template string bindings in the client
2021-05-04 22:32:22 +12:00
return "cxxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, c => {
const r = (Math.random() * 16) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8
return v.toString(16)
})
}