@aitianyu.cn/types 0.0.3 → 0.0.5

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.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.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; } });
@@ -36,6 +36,8 @@ Object.defineProperty(exports, "parseAreaString", { enumerable: true, get: funct
36
36
  var Log_1 = require("./utilities/core/Log");
37
37
  Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return Log_1.Log; } });
38
38
  Object.defineProperty(exports, "Performance", { enumerable: true, get: function () { return Log_1.Performance; } });
39
+ var TypeConvertion_1 = require("./utilities/core/TypeConvertion");
40
+ Object.defineProperty(exports, "getBoolean", { enumerable: true, get: function () { return TypeConvertion_1.getBoolean; } });
39
41
  //// object
40
42
  var Calculater_1 = require("./utilities/core/object/Calculater");
41
43
  Object.defineProperty(exports, "ObjectCalculater", { enumerable: true, get: function () { return Calculater_1.ObjectCalculater; } });
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**@format */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getBoolean = void 0;
5
+ function getBoolean(value) {
6
+ if (value === null) {
7
+ return false;
8
+ }
9
+ switch (typeof value) {
10
+ case "boolean":
11
+ return value;
12
+ case "number":
13
+ return !!value;
14
+ case "string":
15
+ if (!value) {
16
+ return false;
17
+ }
18
+ return value.toLowerCase() === "false" ? false : true;
19
+ case "undefined":
20
+ return false;
21
+ default:
22
+ return true;
23
+ }
24
+ }
25
+ exports.getBoolean = getBoolean;
@@ -12,6 +12,7 @@ export { type PathTargetType, Path } from "./utilities/coding/Path";
12
12
  export { ArgumentNullOrEmptyException, ObjectCloneFunctionNotSupportException, ObjectMergeStatusCheckFailedException, ObjectDiffApplyInvalidStatusException, ObjectDiffMergeFailedException, } from "./utilities/core/Errors";
13
13
  export { parseAreaCode, parseAreaString } from "./utilities/core/Language";
14
14
  export { Log, Performance } from "./utilities/core/Log";
15
+ export { getBoolean } from "./utilities/core/TypeConvertion";
15
16
  export { ObjectCalculater } from "./utilities/core/object/Calculater";
16
17
  export { ObjectHelper } from "./utilities/core/object/Helper";
17
18
  export { guid } from "./utilities/security/Guid";
@@ -0,0 +1,2 @@
1
+ /**@format */
2
+ export declare function getBoolean(value: any): boolean;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@aitianyu.cn/types",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "description": "Common modules (types, functions, classes) for aitianyu",
6
6
  "main": "./dist/lib/index.js",
7
7
  "types": "./dist/types/index.d.ts",
8
8
  "exports": {
9
+ ".": "./dist/lib/index.js",
9
10
  "./types": "./dist/lib/types/index.js",
10
11
  "./coding": "./dist/lib/utilities/coding/index.js",
11
12
  "./core": "./dist/lib/utilities/core/index.js",
@@ -24,8 +25,8 @@
24
25
  "start": "ts-node packages/index.ts",
25
26
  "build": "npm run before-build && npm run compiler && npm run copy-lib && npm run copy-types && npm run after-build",
26
27
  "compiler": "tsc && tsc-alias",
27
- "copy-lib": "copyfiles -u 2 build/src/**/*.js dist/lib",
28
- "copy-types": "copyfiles -u 2 build/src/**/*.d.ts dist/types",
28
+ "copy-lib": "copyfiles -u 2 \"build/src/**/*.js\" \"dist/lib\"",
29
+ "copy-types": "copyfiles -u 2 \"build/src/**/*.d.ts\" \"dist/types\"",
29
30
  "before-build": "rimraf ./dist ./build",
30
31
  "after-build": "rimraf ./build",
31
32
  "test": "jest --no-cache --verbose",