From 53d8891165b5636c20c8033146e124dc9b8a3dd1 Mon Sep 17 00:00:00 2001 From: Robert Kieffer Date: Wed, 11 Oct 2023 09:12:25 -0700 Subject: [PATCH 1/2] fix: revert "perf: remove superfluous call to toLowerCase (#677)" This reverts commit e53793f5be93413cad68b05b3a339ca23e993342. --- src/stringify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stringify.js b/src/stringify.js index 3d15e61a..3e66728d 100644 --- a/src/stringify.js +++ b/src/stringify.js @@ -34,7 +34,7 @@ export function unsafeStringify(arr, offset = 0) { byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]] - ); + ).toLowerCase(); } function stringify(arr, offset = 0) { From f078b0e548cc6a8b88eeb8a97b7b740d2f592090 Mon Sep 17 00:00:00 2001 From: Robert Kieffer Date: Wed, 11 Oct 2023 09:40:44 -0700 Subject: [PATCH 2/2] chore: add comment to future-self --- src/stringify.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stringify.js b/src/stringify.js index 3e66728d..8e80d2d1 100644 --- a/src/stringify.js +++ b/src/stringify.js @@ -13,6 +13,9 @@ for (let i = 0; i < 256; ++i) { export function unsafeStringify(arr, offset = 0) { // Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + // + // Note to future-self: No, you can't remove the `toLowerCase()` call. + // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351 return ( byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] +