1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00
squid-js/src/utils/GeneratorHelpers.ts

10 lines
195 B
TypeScript
Raw Normal View History

2019-06-20 00:20:09 +02:00
import { v4 } from 'uuid'
2019-02-14 12:37:52 +01:00
export function generateId(length = 64) {
2019-06-20 00:20:09 +02:00
let id = ''
2019-02-21 18:14:07 +01:00
while (id.length < length) {
2019-06-20 00:20:09 +02:00
id += v4().replace(/-/g, '')
2019-02-14 12:37:52 +01:00
}
return id.substr(0, length)
}