qmwts 1.1.9 → 1.1.11
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/{index.d.ts → src/index.d.ts} +2 -1
- package/dist/{index.js → src/index.js} +3 -1
- package/dist/src/interfaces/User.d.ts +4 -0
- package/dist/src/interfaces/User.js +2 -0
- package/dist/{utils → src/utils}/json-utils.d.ts +0 -2
- package/dist/{utils → src/utils}/json-utils.js +7 -12
- package/dist/src/utils/prototype-utils.d.ts +11 -0
- package/dist/src/utils/prototype-utils.js +28 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +9 -0
- package/package.json +2 -3
- /package/dist/{utils → src/utils}/number-utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/number-utils.js +0 -0
- /package/dist/{utils → src/utils}/uuid-utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/uuid-utils.js +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import NumberUtils from './utils/number-utils';
|
|
2
2
|
import JsonUtils from './utils/json-utils';
|
|
3
3
|
import UUIDUtils from './utils/uuid-utils';
|
|
4
|
-
|
|
4
|
+
import PrototypeUtils from './utils/prototype-utils';
|
|
5
|
+
export { NumberUtils, JsonUtils, UUIDUtils, PrototypeUtils };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UUIDUtils = exports.JsonUtils = exports.NumberUtils = void 0;
|
|
3
|
+
exports.PrototypeUtils = exports.UUIDUtils = exports.JsonUtils = exports.NumberUtils = void 0;
|
|
4
4
|
// https://www.jianshu.com/p/8fa2c50720e4
|
|
5
5
|
var number_utils_1 = require("./utils/number-utils");
|
|
6
6
|
exports.NumberUtils = number_utils_1.default;
|
|
@@ -8,3 +8,5 @@ var json_utils_1 = require("./utils/json-utils");
|
|
|
8
8
|
exports.JsonUtils = json_utils_1.default;
|
|
9
9
|
var uuid_utils_1 = require("./utils/uuid-utils");
|
|
10
10
|
exports.UUIDUtils = uuid_utils_1.default;
|
|
11
|
+
var prototype_utils_1 = require("./utils/prototype-utils");
|
|
12
|
+
exports.PrototypeUtils = prototype_utils_1.default;
|
|
@@ -1,39 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var prototype_utils_1 = require("./prototype-utils");
|
|
3
4
|
exports.default = {
|
|
4
|
-
isPrototypeObject: function (o) {
|
|
5
|
-
return Object.prototype.toString.call(o) === '[object Object]';
|
|
6
|
-
},
|
|
7
|
-
isPrototypeArray: function (o) {
|
|
8
|
-
return Object.prototype.toString.call(o) === '[object Array]';
|
|
9
|
-
},
|
|
10
5
|
isObject: function (o) {
|
|
11
|
-
if (
|
|
6
|
+
if (prototype_utils_1.default.isObject(o))
|
|
12
7
|
return true;
|
|
13
8
|
try {
|
|
14
|
-
return
|
|
9
|
+
return prototype_utils_1.default.isObject(JSON.parse(o));
|
|
15
10
|
}
|
|
16
11
|
catch (e) {
|
|
17
12
|
return false;
|
|
18
13
|
}
|
|
19
14
|
},
|
|
20
15
|
isArray: function (o) {
|
|
21
|
-
if (
|
|
16
|
+
if (prototype_utils_1.default.isArray(o))
|
|
22
17
|
return true;
|
|
23
18
|
try {
|
|
24
|
-
return
|
|
19
|
+
return prototype_utils_1.default.isArray(JSON.parse(o));
|
|
25
20
|
}
|
|
26
21
|
catch (e) {
|
|
27
22
|
return false;
|
|
28
23
|
}
|
|
29
24
|
},
|
|
30
25
|
parseObject: function (o) {
|
|
31
|
-
if (
|
|
26
|
+
if (prototype_utils_1.default.isObject(o))
|
|
32
27
|
return o;
|
|
33
28
|
return this.isObject(o) ? JSON.parse(o) : {};
|
|
34
29
|
},
|
|
35
30
|
parseArray: function (o) {
|
|
36
|
-
if (
|
|
31
|
+
if (prototype_utils_1.default.isArray(o))
|
|
37
32
|
return o;
|
|
38
33
|
return this.isArray(o) ? JSON.parse(o) : [];
|
|
39
34
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
isObject(o: any): boolean;
|
|
3
|
+
isArray(o: any): boolean;
|
|
4
|
+
isFile(o: any): boolean;
|
|
5
|
+
isNumber(o: any): boolean;
|
|
6
|
+
isDate(o: any): boolean;
|
|
7
|
+
isFunction(o: any): boolean;
|
|
8
|
+
isBoolean(o: any): boolean;
|
|
9
|
+
isString(o: any): boolean;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
isObject: function (o) {
|
|
5
|
+
return Object.prototype.toString.call(o) === '[object Object]';
|
|
6
|
+
},
|
|
7
|
+
isArray: function (o) {
|
|
8
|
+
return Object.prototype.toString.call(o) === '[object Array]';
|
|
9
|
+
},
|
|
10
|
+
isFile: function (o) {
|
|
11
|
+
return Object.prototype.toString.call(o) === '[object File]';
|
|
12
|
+
},
|
|
13
|
+
isNumber: function (o) {
|
|
14
|
+
return Object.prototype.toString.call(o) === '[object Number]';
|
|
15
|
+
},
|
|
16
|
+
isDate: function (o) {
|
|
17
|
+
return Object.prototype.toString.call(o) === '[object Date]';
|
|
18
|
+
},
|
|
19
|
+
isFunction: function (o) {
|
|
20
|
+
return Object.prototype.toString.call(o) === '[object Function]';
|
|
21
|
+
},
|
|
22
|
+
isBoolean: function (o) {
|
|
23
|
+
return Object.prototype.toString.call(o) === '[object Boolean]';
|
|
24
|
+
},
|
|
25
|
+
isString: function (o) {
|
|
26
|
+
return Object.prototype.toString.call(o) === '[object String]';
|
|
27
|
+
},
|
|
28
|
+
};
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test.js
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qmwts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"test": "jest"
|
|
10
|
-
"publish": "npm publish"
|
|
9
|
+
"test": "jest"
|
|
11
10
|
},
|
|
12
11
|
"author": "qmw",
|
|
13
12
|
"license": "ISC",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|