summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/uuid/lib/bytesToUuid.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/uuid/lib/bytesToUuid.js')
-rw-r--r--deps/npm/node_modules/uuid/lib/bytesToUuid.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/deps/npm/node_modules/uuid/lib/bytesToUuid.js b/deps/npm/node_modules/uuid/lib/bytesToUuid.js
index 2c9a22309a..f201a88854 100644
--- a/deps/npm/node_modules/uuid/lib/bytesToUuid.js
+++ b/deps/npm/node_modules/uuid/lib/bytesToUuid.js
@@ -10,14 +10,15 @@ for (var i = 0; i < 256; ++i) {
function bytesToUuid(buf, offset) {
var i = offset || 0;
var bth = byteToHex;
- return bth[buf[i++]] + bth[buf[i++]] +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] + '-' +
- bth[buf[i++]] + bth[buf[i++]] +
- bth[buf[i++]] + bth[buf[i++]] +
- bth[buf[i++]] + bth[buf[i++]];
+ // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
+ return ([bth[buf[i++]], bth[buf[i++]],
+ bth[buf[i++]], bth[buf[i++]], '-',
+ bth[buf[i++]], bth[buf[i++]], '-',
+ bth[buf[i++]], bth[buf[i++]], '-',
+ bth[buf[i++]], bth[buf[i++]], '-',
+ bth[buf[i++]], bth[buf[i++]],
+ bth[buf[i++]], bth[buf[i++]],
+ bth[buf[i++]], bth[buf[i++]]]).join('');
}
module.exports = bytesToUuid;