From dde5f7da9c9c1f80c9ac5891c0e7821c6dfc08df Mon Sep 17 00:00:00 2001 From: Bochkarev Artem Date: Wed, 17 Apr 2024 15:37:51 +0300 Subject: [PATCH 1/2] Fix for #165 Fix process.env --- src/operation.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/operation.js b/src/operation.js index 793f748..d030c19 100644 --- a/src/operation.js +++ b/src/operation.js @@ -7,14 +7,9 @@ import SweepEvent from "./sweep-event" import SweepLine from "./sweep-line" // Limits on iterative processes to prevent infinite loops - usually caused by floating-point math round-off errors. -const POLYGON_CLIPPING_MAX_QUEUE_SIZE = - (typeof process !== "undefined" && - process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE) || - 1000000 -const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = - (typeof process !== "undefined" && - process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) || - 1000000 +const env = (typeof process !== "undefined" && typeof process.env !== "undefined") ? process.env : {} +const POLYGON_CLIPPING_MAX_QUEUE_SIZE = env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1000000 +const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1000000 export class Operation { run(type, geom, moreGeoms) { From 9b467c75b6d1ee450841bc0677ad9822fa886f14 Mon Sep 17 00:00:00 2001 From: Bochkarev Artem Date: Wed, 17 Apr 2024 15:44:45 +0300 Subject: [PATCH 2/2] prettier --- src/operation.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/operation.js b/src/operation.js index d030c19..f2308d0 100644 --- a/src/operation.js +++ b/src/operation.js @@ -7,9 +7,14 @@ import SweepEvent from "./sweep-event" import SweepLine from "./sweep-line" // Limits on iterative processes to prevent infinite loops - usually caused by floating-point math round-off errors. -const env = (typeof process !== "undefined" && typeof process.env !== "undefined") ? process.env : {} -const POLYGON_CLIPPING_MAX_QUEUE_SIZE = env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1000000 -const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1000000 +const env = + typeof process !== "undefined" && typeof process.env !== "undefined" + ? process.env + : {} +const POLYGON_CLIPPING_MAX_QUEUE_SIZE = + env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1000000 +const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = + env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1000000 export class Operation { run(type, geom, moreGeoms) {