summaryrefslogtreecommitdiff
path: root/src/web/app/common/scripts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-05-11 07:19:26 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-05-11 07:19:26 +0900
commit4da7d84c0ad52bb960436a21cf1c3e05a9886b1c (patch)
tree9645c215d0ad18ef068a90d99b124d97cf63d0f1 /src/web/app/common/scripts
parentRefactor (diff)
downloadsharkey-4da7d84c0ad52bb960436a21cf1c3e05a9886b1c.tar.gz
sharkey-4da7d84c0ad52bb960436a21cf1c3e05a9886b1c.tar.bz2
sharkey-4da7d84c0ad52bb960436a21cf1c3e05a9886b1c.zip
Refactor
Diffstat (limited to 'src/web/app/common/scripts')
-rw-r--r--src/web/app/common/scripts/uuid.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/web/app/common/scripts/uuid.js b/src/web/app/common/scripts/uuid.js
index 6a103d6e04..ff016e18ad 100644
--- a/src/web/app/common/scripts/uuid.js
+++ b/src/web/app/common/scripts/uuid.js
@@ -1,12 +1,18 @@
+/**
+ * Generate a UUID
+ */
export default () => {
- var uuid = '', i, random;
- for (i = 0; i < 32; i++) {
- random = Math.random() * 16 | 0;
+ let uuid = '';
+
+ for (let i = 0; i < 32; i++) {
+ const random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += '-';
}
+
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
+
return uuid;
};