From e19e30eba3855043751823cc462f8a28d7cb9b1b Mon Sep 17 00:00:00 2001
From: Yuriy Maksymets <iurii.maksymets@gmail.com>
Date: Sun, 1 Dec 2019 23:52:18 +0000
Subject: [PATCH] Fixed webpack argument issue

---
 src/shapes.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shapes.js b/src/shapes.js
index 213b02b..dbfa79c 100644
--- a/src/shapes.js
+++ b/src/shapes.js
@@ -16,7 +16,8 @@ function getDistance(p1, p2) {
   return Math.hypot(x1 - x0, y1 - y0)
 }
 
-function vectorLength([x, y]) {
+function vectorLen(v) {
+  const [x, y] = v
   return Math.hypot(x, y)
 }
 
@@ -26,7 +27,7 @@ function diffVector([x0, y0], [x1, y1]) {
 
 function angleBetweenVectors(p1, p2) {
   const [[x0, y0], [x1, y1]] = [p1, p2]
-  return Math.acos((x0 * x1 + y0 * y1) / (vectorLength(p1) * vectorLength(p2)))
+  return Math.acos((x0 * x1 + y0 * y1) / (vectorLen(p1) * vectorLen(p2)))
 }
 
 function boundingCoords(points) {
@@ -127,7 +128,6 @@ function couldBeLine(points) {
   )
   const pivot = points[0]
   let cumulativeThreshold = 0
-
   for (let i = 2; i < points.length; i++) {
     const prev = points[i - 1]
     const curr = points[i]
@@ -136,7 +136,7 @@ function couldBeLine(points) {
     const angle = angleBetweenVectors(d1, d2)
 
     if (Math.abs(angle) > LINE_ANGLE_THRESHOLD) {
-      const d2Len = vectorLength(d2)
+      const d2Len = vectorLen(d2)
       if (cumulativeThreshold < vectorThreshold && d2Len < vectorThreshold) {
         cumulativeThreshold += d2Len
         continue
-- 
GitLab