diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-08-31 04:46:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-30 22:46:58 +0200 |
commit | 39912f201836e945a66583f62bfcae72655382f1 (patch) | |
tree | 45b5cf45c5a5999acf01d2b2056021d1c95a03a0 | |
parent | 0ea0c87b15377a3a3035a7ca6b1b3ef14488c394 (diff) |
refactor(std/uuid): remove dependency on isString from std/node (#7273)
-rw-r--r-- | std/uuid/v5.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/std/uuid/v5.ts b/std/uuid/v5.ts index 6375e7bab..e940f0c68 100644 --- a/std/uuid/v5.ts +++ b/std/uuid/v5.ts @@ -7,7 +7,6 @@ import { uuidToBytes, } from "./_common.ts"; import { Sha1 } from "../hash/sha1.ts"; -import { isString } from "../node/util.ts"; import { assert } from "../_util/assert.ts"; const UUID_RE = @@ -30,8 +29,14 @@ export function generate( const i = (buf && offset) || 0; let { value, namespace } = options; - if (isString(value)) value = stringToBytes(value as string); - if (isString(namespace)) namespace = uuidToBytes(namespace as string); + if (typeof value == "string") { + value = stringToBytes(value as string); + } + + if (typeof namespace == "string") { + namespace = uuidToBytes(namespace as string); + } + assert( namespace.length === 16, "namespace must be uuid string or an Array of 16 byte values", |