qmwts 1.1.22 → 1.1.24

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 CHANGED
@@ -3,4 +3,5 @@ import JsonUtils from './utils/json-utils';
3
3
  import UUIDUtils from './utils/uuid-utils';
4
4
  import PrototypeUtils from './utils/prototype-utils';
5
5
  import RequestDataGenerator from './utils/request-data-generator';
6
- export { NumberUtils, JsonUtils, UUIDUtils, PrototypeUtils, RequestDataGenerator, };
6
+ import FileUtils from './utils/file-utils';
7
+ export { NumberUtils, JsonUtils, UUIDUtils, PrototypeUtils, RequestDataGenerator, FileUtils, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RequestDataGenerator = exports.PrototypeUtils = exports.UUIDUtils = exports.JsonUtils = exports.NumberUtils = void 0;
3
+ exports.FileUtils = exports.RequestDataGenerator = 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;
@@ -12,3 +12,5 @@ var prototype_utils_1 = require("./utils/prototype-utils");
12
12
  exports.PrototypeUtils = prototype_utils_1.default;
13
13
  var request_data_generator_1 = require("./utils/request-data-generator");
14
14
  exports.RequestDataGenerator = request_data_generator_1.default;
15
+ var file_utils_1 = require("./utils/file-utils");
16
+ exports.FileUtils = file_utils_1.default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ formatSize(size: number): string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ formatSize: function (size) {
5
+ var units = ['B', 'KB', 'MB', 'GB', 'TB'];
6
+ var index = 0;
7
+ var s = size;
8
+ while (s >= 1024 && index < units.length - 1) {
9
+ index++;
10
+ s = s / 1024;
11
+ }
12
+ return s.toFixed(1) + units[index];
13
+ }
14
+ };
@@ -4,5 +4,6 @@ declare const _default: {
4
4
  parseObject<T>(o: any): T;
5
5
  parseArray<T_1>(o: any): T_1[];
6
6
  optionalChaining(o: any, chain: string, substitute?: any): any;
7
+ setNull(o?: any, exclusions?: any): any;
7
8
  };
8
9
  export default _default;
@@ -41,5 +41,14 @@ exports.default = {
41
41
  o = o[key] || '';
42
42
  }
43
43
  return o || substitute;
44
+ },
45
+ // 返回一个值被全部设为null的object,主要用于naive-ui
46
+ setNull: function (o, exclusions) {
47
+ if (o === void 0) { o = {}; }
48
+ if (exclusions === void 0) { exclusions = []; }
49
+ for (var key in o)
50
+ if (!exclusions.includes(key))
51
+ o[key] = null;
52
+ return o;
44
53
  }
45
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qmwts",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",