@aitianyu.cn/types 0.0.6 → 0.0.7

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/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**@format */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.hash = exports.guid = exports.ObjectHelper = exports.ObjectCalculater = exports.getBoolean = exports.Performance = exports.Log = exports.parseAreaString = exports.parseAreaCode = exports.ObjectDiffMergeFailedException = exports.ObjectDiffApplyInvalidStatusException = exports.ObjectMergeStatusCheckFailedException = exports.ObjectCloneFunctionNotSupportException = exports.ArgumentNullOrEmptyException = exports.Path = exports.PathDirAndFileConvertInvaild = exports.PathDirectoryValidationFailException = exports.PathProcessorSourceLostException = exports.TMap = exports.EncryptOption = exports.PathBase = exports.LogLevel = exports.Exception = exports.AreaCode = void 0;
4
+ exports.hash = exports.guid = exports.ArrayHelper = exports.ObjectHelper = exports.ObjectCalculater = exports.getBoolean = exports.Performance = exports.Log = exports.parseAreaString = exports.parseAreaCode = exports.ObjectDiffMergeFailedException = exports.ObjectDiffApplyInvalidStatusException = exports.ObjectMergeStatusCheckFailedException = exports.ObjectCloneFunctionNotSupportException = exports.ArgumentNullOrEmptyException = exports.Path = exports.PathDirAndFileConvertInvaild = exports.PathDirectoryValidationFailException = exports.PathProcessorSourceLostException = exports.TMap = exports.EncryptOption = exports.PathBase = exports.LogLevel = exports.Exception = exports.AreaCode = void 0;
5
5
  // src/types
6
6
  var AreaCode_1 = require("./types/AreaCode");
7
7
  Object.defineProperty(exports, "AreaCode", { enumerable: true, get: function () { return AreaCode_1.AreaCode; } });
@@ -43,6 +43,8 @@ var Calculater_1 = require("./utilities/core/object/Calculater");
43
43
  Object.defineProperty(exports, "ObjectCalculater", { enumerable: true, get: function () { return Calculater_1.ObjectCalculater; } });
44
44
  var Helper_1 = require("./utilities/core/object/Helper");
45
45
  Object.defineProperty(exports, "ObjectHelper", { enumerable: true, get: function () { return Helper_1.ObjectHelper; } });
46
+ var Operator_1 = require("./utilities/core/object/Operator");
47
+ Object.defineProperty(exports, "ArrayHelper", { enumerable: true, get: function () { return Operator_1.ArrayHelper; } });
46
48
  // security
47
49
  var Guid_1 = require("./utilities/security/Guid");
48
50
  Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return Guid_1.guid; } });
@@ -21,7 +21,7 @@ function _consoleLog(level, msg, timer) {
21
21
  if (timer) {
22
22
  const date = new Date(Date.now());
23
23
  const millisecondString = date.getMilliseconds().toString();
24
- timeString = `[${date.toLocaleTimeString()}.${millisecondString.substring(0, millisecondString.length > 3 ? 3 : millisecondString.length)}]`;
24
+ timeString = `[${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${millisecondString.substring(0, millisecondString.length > 3 ? 3 : millisecondString.length)}]`;
25
25
  }
26
26
  const logMessage = `[${level.name}] ${timeString} ${msg}`;
27
27
  switch (level.value) {
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**@format */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ArrayHelper = void 0;
5
+ /** Array type related tools */
6
+ class ArrayHelper {
7
+ /**
8
+ * To merge multiple arrays into a new array and remove duplicated elements.
9
+ *
10
+ * @param {any[]} array arrays
11
+ * @returns return a new array
12
+ */
13
+ static merge(...array) {
14
+ if (array.length === 0) {
15
+ return [];
16
+ }
17
+ const result = [];
18
+ for (const item of array) {
19
+ if (Array.isArray(item)) {
20
+ for (const arrItem of item) {
21
+ if (!result.includes(arrItem)) {
22
+ result.push(arrItem);
23
+ }
24
+ }
25
+ }
26
+ else {
27
+ if (!result.includes(item)) {
28
+ result.push(item);
29
+ }
30
+ }
31
+ }
32
+ return result;
33
+ }
34
+ }
35
+ exports.ArrayHelper = ArrayHelper;
@@ -15,5 +15,6 @@ export { Log, Performance } from "./utilities/core/Log";
15
15
  export { getBoolean } from "./utilities/core/TypeConvertion";
16
16
  export { ObjectCalculater } from "./utilities/core/object/Calculater";
17
17
  export { ObjectHelper } from "./utilities/core/object/Helper";
18
+ export { ArrayHelper } from "./utilities/core/object/Operator";
18
19
  export { guid } from "./utilities/security/Guid";
19
20
  export { hash } from "./utilities/security/Hash";
@@ -0,0 +1,11 @@
1
+ /**@format */
2
+ /** Array type related tools */
3
+ export declare class ArrayHelper {
4
+ /**
5
+ * To merge multiple arrays into a new array and remove duplicated elements.
6
+ *
7
+ * @param {any[]} array arrays
8
+ * @returns return a new array
9
+ */
10
+ static merge(...array: any[]): any[];
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aitianyu.cn/types",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "description": "Common modules (types, functions, classes) for aitianyu",
6
6
  "main": "./dist/lib/index.js",