@minto-ai/tools 1.0.49 → 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.
- package/dist/index.js +14 -0
- package/dist/math/calc-aspect-ratio.d.ts +9 -0
- package/dist/math/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13562,6 +13562,19 @@ function add2(augend, addend) {
|
|
|
13562
13562
|
var sum = scaledAugend + scaledAddend;
|
|
13563
13563
|
return sum / scalingFactor;
|
|
13564
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
|
+
}
|
|
13565
13578
|
function divide2(dividend, divisor) {
|
|
13566
13579
|
if (divisor === 0) {
|
|
13567
13580
|
throw new Error("除数不能为零");
|
|
@@ -13680,6 +13693,7 @@ export {
|
|
|
13680
13693
|
add2 as add,
|
|
13681
13694
|
batchDownloadFile,
|
|
13682
13695
|
beParsedAsNumber,
|
|
13696
|
+
calcAspectRatio,
|
|
13683
13697
|
canBeParsedAsNumber,
|
|
13684
13698
|
checkArrayEmpty,
|
|
13685
13699
|
checkEmpty,
|
package/dist/math/index.d.ts
CHANGED
|
@@ -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 };
|