@minto-ai/tools 1.0.48 → 1.0.50

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.
@@ -21,7 +21,6 @@ declare const FileSuffixEnum: {
21
21
  readonly MP3: "mp3";
22
22
  readonly WAV: "wav";
23
23
  readonly TXT: "txt";
24
- readonly HTML: "html";
25
24
  readonly ZIP: "zip";
26
25
  readonly RAR: "rar";
27
26
  };
@@ -1,6 +1,6 @@
1
1
  import { CompressFileSuffix, DocumentFileSuffix, FileSuffix, ImageFileSuffix, MusicFileSuffix, PptFileSuffix, VideoFileSuffix } from './types';
2
2
  import { default as batchDownloadFile } from './batch-download-file';
3
- import { FileSuffixEnum, ImageFileSuffixEnum } from './extends/enum';
3
+ import { CompressFileSuffixEnum, DocumentFileSuffixEnum, FileSuffixEnum, ImageFileSuffixEnum, MusicFileSuffixEnum, PptFileSuffixEnum, VideoFileSuffixEnum } from './extends/enum';
4
4
  import { default as getFileIcon } from './get-file-icon';
5
5
  import { default as getFileName } from './get-file-name';
6
6
  import { default as getFilePathNotQuery } from './get-file-path-not-query';
@@ -17,4 +17,4 @@ import { default as isPptFilePath } from './is-ppt-file-path';
17
17
  import { default as isVideoFilePath } from './is-video-file-path';
18
18
  import { default as singleDownloadFile } from './single-download-file';
19
19
  export type { CompressFileSuffix, DocumentFileSuffix, FileSuffix, ImageFileSuffix, MusicFileSuffix, PptFileSuffix, VideoFileSuffix, };
20
- export { batchDownloadFile, FileSuffixEnum, getFileIcon, getFileName, getFilePathNotQuery, getFileQuery, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isCompressFilePath, isDocumentFilePath, isFilePath, isImageFilePath, isMusicFilePath, isPptFilePath, isVideoFilePath, singleDownloadFile, };
20
+ export { batchDownloadFile, CompressFileSuffixEnum, DocumentFileSuffixEnum, FileSuffixEnum, getFileIcon, getFileName, getFilePathNotQuery, getFileQuery, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isCompressFilePath, isDocumentFilePath, isFilePath, isImageFilePath, isMusicFilePath, isPptFilePath, isVideoFilePath, MusicFileSuffixEnum, PptFileSuffixEnum, singleDownloadFile, VideoFileSuffixEnum, };
package/dist/index.js CHANGED
@@ -13204,7 +13204,6 @@ var FileSuffixEnum = {
13204
13204
  MP3: "mp3",
13205
13205
  WAV: "wav",
13206
13206
  TXT: "txt",
13207
- HTML: "html",
13208
13207
  ZIP: "zip",
13209
13208
  RAR: "rar"
13210
13209
  };
@@ -13563,6 +13562,19 @@ function add2(augend, addend) {
13563
13562
  var sum = scaledAugend + scaledAddend;
13564
13563
  return sum / scalingFactor;
13565
13564
  }
13565
+ function calcAspectRatio(_ref) {
13566
+ var _ref2 = _slicedToArray(_ref, 2), width = _ref2[0], height = _ref2[1];
13567
+ if (width === 0 || height === 0) {
13568
+ return [0, 0];
13569
+ }
13570
+ var w = Math.abs(Math.round(width));
13571
+ var h = Math.abs(Math.round(height));
13572
+ function gcd(a, b) {
13573
+ return b === 0 ? a : gcd(b, a % b);
13574
+ }
13575
+ var divisor = gcd(w, h);
13576
+ return [w / divisor, h / divisor];
13577
+ }
13566
13578
  function divide2(dividend, divisor) {
13567
13579
  if (divisor === 0) {
13568
13580
  throw new Error("除数不能为零");
@@ -13671,11 +13683,17 @@ function createWorker(fun) {
13671
13683
  return worker;
13672
13684
  }
13673
13685
  export {
13686
+ CompressFileSuffixEnum,
13687
+ DocumentFileSuffixEnum,
13674
13688
  FileSuffixEnum,
13675
13689
  ImageFileSuffixEnum,
13690
+ MusicFileSuffixEnum,
13691
+ PptFileSuffixEnum,
13692
+ VideoFileSuffixEnum,
13676
13693
  add2 as add,
13677
13694
  batchDownloadFile,
13678
13695
  beParsedAsNumber,
13696
+ calcAspectRatio,
13679
13697
  canBeParsedAsNumber,
13680
13698
  checkArrayEmpty,
13681
13699
  checkEmpty,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 计算宽高最简整数比例
3
+ * @param size 尺寸数组
4
+ * @param size.0 宽度值
5
+ * @param size.1 高度值
6
+ * @returns [w, h] 最简整数比例
7
+ */
8
+ declare function calcAspectRatio([width, height]: [number, number]): [number, number];
9
+ export default calcAspectRatio;
@@ -1,6 +1,7 @@
1
1
  import { default as add } from './add';
2
+ import { default as calcAspectRatio } from './calc-aspect-ratio';
2
3
  import { default as divide } from './divide';
3
4
  import { default as getDecimalPlaces } from './get-decimal-places';
4
5
  import { default as multiply } from './multiply';
5
6
  import { default as subtract } from './subtract';
6
- export { add, divide, getDecimalPlaces, multiply, subtract };
7
+ export { add, calcAspectRatio, divide, getDecimalPlaces, multiply, subtract };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@minto-ai/tools",
3
3
  "type": "module",
4
- "version": "1.0.48",
4
+ "version": "1.0.50",
5
5
  "description": "明途公共工具库",
6
6
  "author": "hcc",
7
7
  "license": "ISC",