vroom-web-sdk-beta
Version:
VROOM SDK (beta) by True Virtual World
22 lines (19 loc) • 613 B
text/typescript
export default class HelperFunction {
public randomString (len: number) {
let charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
let randomString = ''
for (let i = 0; i < len; i++) {
let randomPoz = Math.floor(Math.random() * charSet.length)
randomString += charSet.charAt(randomPoz)
}
return randomString
}
public getRoomIdFromUrl (url: string): number | null {
const match = url.indexOf('?') > -1 ? url.match(/\/(\d+)\?/) : url.split('https://')[1].split('/')
if (match) {
return +match[1]
} else {
return null
}
}
}