mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
13 lines
336 B
JavaScript
13 lines
336 B
JavaScript
const createId = async (length = 32) => {
|
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
let result = ''
|
|
let counter = 0
|
|
while (counter < length) {
|
|
result += characters.charAt(Math.floor(Math.random() * characters.length))
|
|
counter += 1
|
|
}
|
|
return result
|
|
}
|
|
|
|
export default createId
|