hsu-utils 0.0.31 → 0.0.33
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/README.md +13 -1
- package/dist/hsu-utils.js +24 -2
- package/dist/hsu-utils.min.js +1 -1
- package/dist/hsu-utils.min.js.LICENSE.txt +1 -1
- package/es/DeepCopy/index.d.ts +1 -1
- package/es/GenerateRandomStr/index.d.ts +1 -0
- package/es/GenerateRandomStr/index.js +9 -0
- package/es/GetTimeDifference/index.d.ts +9 -0
- package/es/GetTimeDifference/index.js +9 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/lib/DeepCopy/index.d.ts +1 -1
- package/lib/GenerateRandomStr/index.d.ts +1 -0
- package/lib/GenerateRandomStr/index.js +12 -0
- package/lib/GetTimeDifference/index.d.ts +9 -0
- package/lib/GetTimeDifference/index.js +12 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.js +5 -1
- package/package.json +1 -1
package/es/DeepCopy/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export default function deepCopy<T
|
1
|
+
export default function deepCopy<T>(data: T): T;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function generateRandomStr(length: number): string;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export default function generateRandomStr(length) {
|
2
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
3
|
+
let result = '';
|
4
|
+
for (let i = 0; i < length; i++) {
|
5
|
+
const randomIndex = Math.floor(Math.random() * characters.length);
|
6
|
+
result += characters[randomIndex];
|
7
|
+
}
|
8
|
+
return result;
|
9
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export default function getTimeDifference(start, end) {
|
2
|
+
const diff = new Date(end).valueOf() - new Date(start).valueOf();
|
3
|
+
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
|
4
|
+
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
5
|
+
const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
|
6
|
+
const seconds = Math.floor((diff % (1000 * 60)) / 1000);
|
7
|
+
const milliseconds = diff % 1000;
|
8
|
+
return { days, hours, minutes, seconds, milliseconds };
|
9
|
+
}
|
package/es/index.d.ts
CHANGED
@@ -8,6 +8,8 @@ import loadImage from './LoadImage';
|
|
8
8
|
import RenderPDF from './RenderPDF';
|
9
9
|
import downloadFile from './DownloadFile';
|
10
10
|
import array_is_includes from './ArrayIsIncludes';
|
11
|
-
|
11
|
+
import generateRandomStr from './GenerateRandomStr';
|
12
|
+
import getTimeDifference from './GetTimeDifference';
|
13
|
+
export { console_table, deepCopy, Equal, Typeof, get_string_size, ConvertNumbers, loadImage, RenderPDF, downloadFile, array_is_includes, generateRandomStr, getTimeDifference };
|
12
14
|
import { ConsoleData } from './ConsoleTable';
|
13
15
|
export type { ConsoleData };
|
package/es/index.js
CHANGED
@@ -8,4 +8,6 @@ import loadImage from './LoadImage';
|
|
8
8
|
import RenderPDF from './RenderPDF';
|
9
9
|
import downloadFile from './DownloadFile';
|
10
10
|
import array_is_includes from './ArrayIsIncludes';
|
11
|
-
|
11
|
+
import generateRandomStr from './GenerateRandomStr';
|
12
|
+
import getTimeDifference from './GetTimeDifference';
|
13
|
+
export { console_table, deepCopy, Equal, Typeof, get_string_size, ConvertNumbers, loadImage, RenderPDF, downloadFile, array_is_includes, generateRandomStr, getTimeDifference };
|
package/lib/DeepCopy/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export default function deepCopy<T
|
1
|
+
export default function deepCopy<T>(data: T): T;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function generateRandomStr(length: number): string;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
function generateRandomStr(length) {
|
4
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
5
|
+
var result = '';
|
6
|
+
for (var i = 0; i < length; i++) {
|
7
|
+
var randomIndex = Math.floor(Math.random() * characters.length);
|
8
|
+
result += characters[randomIndex];
|
9
|
+
}
|
10
|
+
return result;
|
11
|
+
}
|
12
|
+
exports.default = generateRandomStr;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
function getTimeDifference(start, end) {
|
4
|
+
var diff = new Date(end).valueOf() - new Date(start).valueOf();
|
5
|
+
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
|
6
|
+
var hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
7
|
+
var minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
|
8
|
+
var seconds = Math.floor((diff % (1000 * 60)) / 1000);
|
9
|
+
var milliseconds = diff % 1000;
|
10
|
+
return { days: days, hours: hours, minutes: minutes, seconds: seconds, milliseconds: milliseconds };
|
11
|
+
}
|
12
|
+
exports.default = getTimeDifference;
|
package/lib/index.d.ts
CHANGED
@@ -8,6 +8,8 @@ import loadImage from './LoadImage';
|
|
8
8
|
import RenderPDF from './RenderPDF';
|
9
9
|
import downloadFile from './DownloadFile';
|
10
10
|
import array_is_includes from './ArrayIsIncludes';
|
11
|
-
|
11
|
+
import generateRandomStr from './GenerateRandomStr';
|
12
|
+
import getTimeDifference from './GetTimeDifference';
|
13
|
+
export { console_table, deepCopy, Equal, Typeof, get_string_size, ConvertNumbers, loadImage, RenderPDF, downloadFile, array_is_includes, generateRandomStr, getTimeDifference };
|
12
14
|
import { ConsoleData } from './ConsoleTable';
|
13
15
|
export type { ConsoleData };
|
package/lib/index.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.array_is_includes = exports.downloadFile = exports.RenderPDF = exports.loadImage = exports.ConvertNumbers = exports.get_string_size = exports.Typeof = exports.Equal = exports.deepCopy = exports.console_table = void 0;
|
6
|
+
exports.getTimeDifference = exports.generateRandomStr = exports.array_is_includes = exports.downloadFile = exports.RenderPDF = exports.loadImage = exports.ConvertNumbers = exports.get_string_size = exports.Typeof = exports.Equal = exports.deepCopy = exports.console_table = void 0;
|
7
7
|
var ConsoleTable_1 = __importDefault(require("./ConsoleTable"));
|
8
8
|
exports.console_table = ConsoleTable_1.default;
|
9
9
|
var DeepCopy_1 = __importDefault(require("./DeepCopy"));
|
@@ -24,3 +24,7 @@ var DownloadFile_1 = __importDefault(require("./DownloadFile"));
|
|
24
24
|
exports.downloadFile = DownloadFile_1.default;
|
25
25
|
var ArrayIsIncludes_1 = __importDefault(require("./ArrayIsIncludes"));
|
26
26
|
exports.array_is_includes = ArrayIsIncludes_1.default;
|
27
|
+
var GenerateRandomStr_1 = __importDefault(require("./GenerateRandomStr"));
|
28
|
+
exports.generateRandomStr = GenerateRandomStr_1.default;
|
29
|
+
var GetTimeDifference_1 = __importDefault(require("./GetTimeDifference"));
|
30
|
+
exports.getTimeDifference = GetTimeDifference_1.default;
|