UNPKG

@nozbe/watermelondb

Version:

Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast

15 lines (11 loc) 293 B
// @flow const alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' export default function fallbackRandomId(): string { let id = '' let v = 0 for (let i = 0; i < 16; i += 1) { v = Math.floor(Math.random() * 62) id += alphabet[v % 62] } return id }