|
@@ -6,13 +6,14 @@
|
|
|
|
|
|
import { now } from '../mol-util/now';
|
|
|
|
|
|
+/** A UUID, either standard 36 characters or 22 characters base64 encoded. */
|
|
|
type UUID = string & { '@type': 'uuid' }
|
|
|
|
|
|
namespace UUID {
|
|
|
const _btoa = typeof btoa !== 'undefined' ? btoa : (s: string) => Buffer.from(s).toString('base64')
|
|
|
|
|
|
const chars: string[] = [];
|
|
|
- /** Creates 22 characted "base64" UUID */
|
|
|
+ /** Creates a 22 characters 'base64' encoded UUID */
|
|
|
export function create22(): UUID {
|
|
|
let d = (+new Date()) + now();
|
|
|
for (let i = 0; i < 16; i++) {
|