diginext-utils 1.0.11 → 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/array/index.js +2 -2
- package/dist/string/generateUUID.js +17 -0
- package/dist/string/index.js +2 -15
- package/package.json +14 -2
package/dist/array/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var _math = require("../math");
|
|
|
20
20
|
* @param {Array} array
|
|
21
21
|
* @param {string} key
|
|
22
22
|
* @returns {Number}
|
|
23
|
-
*/
|
|
23
|
+
*/
|
|
24
24
|
const sumArray = (array, key) => {
|
|
25
25
|
if (!array) {
|
|
26
26
|
console.warn("ARRAY NOT EXITED !");
|
|
@@ -45,7 +45,7 @@ const averageArray = (array, key) => {
|
|
|
45
45
|
return 0;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
return (
|
|
48
|
+
return sumArray(array, key) / array.length || 0;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
*
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diginext-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "TOP GROUP (a.k.a Digitop)",
|
|
6
6
|
"email": "dev@wearetopgroup.com"
|
|
@@ -14,7 +14,19 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"publish": "npm publish",
|
|
16
16
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
17
|
-
"build": "rm -rf dist && NODE_ENV=production babel src --out-dir dist --copy-files"
|
|
17
|
+
"build": "rm -rf dist && NODE_ENV=production babel src --out-dir dist --copy-files",
|
|
18
|
+
"watch": "nodemon"
|
|
19
|
+
},
|
|
20
|
+
"nodemonConfig": {
|
|
21
|
+
"exec": "yarn build",
|
|
22
|
+
"watch": [
|
|
23
|
+
"src/*"
|
|
24
|
+
],
|
|
25
|
+
"ignore": [
|
|
26
|
+
"**/__tests__/**",
|
|
27
|
+
"*.test.js",
|
|
28
|
+
"*.spec.js"
|
|
29
|
+
]
|
|
18
30
|
},
|
|
19
31
|
"dependencies": {
|
|
20
32
|
"@babel/polyfill": "^7.12.1",
|