diginext-utils 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/string/generateUUID.js +17 -0
- package/dist/string/index.js +2 -15
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = generateUUID;
|
|
7
|
+
|
|
8
|
+
function generateUUID() {
|
|
9
|
+
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
|
|
10
|
+
const d0 = Math.random() * 0xffffffff | 0;
|
|
11
|
+
const d1 = Math.random() * 0xffffffff | 0;
|
|
12
|
+
const d2 = Math.random() * 0xffffffff | 0;
|
|
13
|
+
const d3 = Math.random() * 0xffffffff | 0;
|
|
14
|
+
const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + "-" + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + "-" + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + "-" + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + "-" + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; // .toLowerCase() here flattens concatenated strings to save heap memory space.
|
|
15
|
+
|
|
16
|
+
return uuid.toLowerCase();
|
|
17
|
+
}
|
package/dist/string/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.clearUnicodeCharacters = exports.capitalizeName = exports.capitalize = exports.allCharacter = void 0;
|
|
7
|
-
exports.generateUUID = generateUUID;
|
|
8
|
-
exports.toUpperCase = exports.toLowerCase = exports.titleize = exports.textLowCase = exports.randomStringByLength = exports.randAllCharacterByLength = exports.punctuation = exports.numeric = exports.makeString = exports.getBetween = void 0;
|
|
6
|
+
exports.toUpperCase = exports.toLowerCase = exports.titleize = exports.textLowCase = exports.randomStringByLength = exports.randAllCharacterByLength = exports.punctuation = exports.numeric = exports.makeString = exports.getBetween = exports.clearUnicodeCharacters = exports.capitalizeName = exports.capitalize = exports.allCharacter = void 0;
|
|
9
7
|
|
|
10
8
|
require("core-js/modules/es.regexp.constructor.js");
|
|
11
9
|
|
|
@@ -517,15 +515,4 @@ const clearUnicodeCharacters = function clearUnicodeCharacters(s) {
|
|
|
517
515
|
return opt.lowercase ? s.toLowerCase() : s;
|
|
518
516
|
};
|
|
519
517
|
|
|
520
|
-
exports.clearUnicodeCharacters = clearUnicodeCharacters;
|
|
521
|
-
|
|
522
|
-
function generateUUID() {
|
|
523
|
-
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
|
|
524
|
-
const d0 = Math.random() * 0xffffffff | 0;
|
|
525
|
-
const d1 = Math.random() * 0xffffffff | 0;
|
|
526
|
-
const d2 = Math.random() * 0xffffffff | 0;
|
|
527
|
-
const d3 = Math.random() * 0xffffffff | 0;
|
|
528
|
-
const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + "-" + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + "-" + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + "-" + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + "-" + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; // .toLowerCase() here flattens concatenated strings to save heap memory space.
|
|
529
|
-
|
|
530
|
-
return uuid.toLowerCase();
|
|
531
|
-
}
|
|
518
|
+
exports.clearUnicodeCharacters = clearUnicodeCharacters;
|