summaryrefslogtreecommitdiff
path: root/std/uuid/v1.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/uuid/v1.ts')
-rw-r--r--std/uuid/v1.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/std/uuid/v1.ts b/std/uuid/v1.ts
index cbfce576a..6e48fa55f 100644
--- a/std/uuid/v1.ts
+++ b/std/uuid/v1.ts
@@ -4,7 +4,7 @@ import { bytesToUuid } from "./_common.ts";
const UUID_RE = new RegExp(
"^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
- "i"
+ "i",
);
export function validate(id: string): boolean {
@@ -29,7 +29,7 @@ type V1Options = {
export function generate(
options?: V1Options | null,
buf?: number[],
- offset?: number
+ offset?: number,
): string | number[] {
let i = (buf && offset) || 0;
const b = buf || [];
@@ -40,8 +40,7 @@ export function generate(
if (node == null || clockseq == null) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- const seedBytes: any =
- options.random ||
+ const seedBytes: any = options.random ||
options.rng ||
crypto.getRandomValues(new Uint8Array(16));
if (node == null) {
@@ -58,8 +57,9 @@ export function generate(
clockseq = _clockseq = ((seedBytes[6] << 8) | seedBytes[7]) & 0x3fff;
}
}
- let msecs =
- options.msecs !== undefined ? options.msecs : new Date().getTime();
+ let msecs = options.msecs !== undefined
+ ? options.msecs
+ : new Date().getTime();
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;