aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-04-29 23:00:22 -0400
committerbobzel <zzzman@gmail.com>2024-04-29 23:00:22 -0400
commitf6a741f38a33bdb30b3a1d88215656dcd3d0712d (patch)
treedf88320222c743d26f2b1341c1489671277baec9 /src/Utils.ts
parentab873e90112f2cac204a57a1b405cc241f7e8381 (diff)
eslint fixes.
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index c87ef052c..3af057d82 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -15,7 +15,7 @@ export namespace Utils {
return uuid.v5(seed, uuid.v5.URL);
}
- export const loggingEnabled: Boolean = false;
+ export const loggingEnabled = false;
export const logFilter: number | undefined = undefined;
export function log(prefixIn: string, messageName: string, messageIn: any, receiving: boolean) {
@@ -135,14 +135,14 @@ export function closestPtBetweenRectangles(l: number, t: number, w: number, h: n
];
const res = hsegs.reduce(
(closest, seg) => {
- const res = distanceBetweenHorizontalLines(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);
- return res[0] < closest[0] ? res : closest;
+ const dist = distanceBetweenHorizontalLines(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);
+ return dist[0] < closest[0] ? dist : closest;
},
[Number.MAX_VALUE, []] as [number, number[]]
);
const fres = vsegs.reduce((closest, seg) => {
- const res = distanceBetweenVerticalLines(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);
- return res[0] < closest[0] ? res : closest;
+ const dist = distanceBetweenVerticalLines(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);
+ return dist[0] < closest[0] ? dist : closest;
}, res);
const near = project(x, y, fres[1][0], fres[1][1], fres[1][2], fres[1][3]);
@@ -175,11 +175,11 @@ export function aggregateBounds(boundsList: { x: number; y: number; width?: numb
const bounds = boundsList
.map(b => ({ x: b.x, y: b.y, r: b.x + (b.width || 0), b: b.y + (b.height || 0) }))
.reduce(
- (bounds, b) => ({
- x: Math.min(b.x, bounds.x),
- y: Math.min(b.y, bounds.y),
- r: Math.max(b.r, bounds.r),
- b: Math.max(b.b, bounds.b),
+ (prevBounds, b) => ({
+ x: Math.min(b.x, prevBounds.x),
+ y: Math.min(b.y, prevBounds.y),
+ r: Math.max(b.r, prevBounds.r),
+ b: Math.max(b.b, prevBounds.b),
}),
{ x: Number.MAX_VALUE, y: Number.MAX_VALUE, r: -Number.MAX_VALUE, b: -Number.MAX_VALUE }
);
@@ -196,7 +196,7 @@ export function intersectRect(r1: { left: number; top: number; width: number; he
export function stringHash(s?: string) {
// eslint-disable-next-line no-bitwise
- return !s ? undefined : Math.abs(s.split('').reduce((a: any, b: any) => (a => a & a)((a << 5) - a + b.charCodeAt(0)), 0));
+ return !s ? undefined : Math.abs(s.split('').reduce((a: any, b: any) => (n => n & n)((a << 5) - a + b.charCodeAt(0)), 0));
}
export function percent2frac(percent: string) {