From 5abc433ac2f583e272972985e38726ddfc0c0030 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 21 Oct 2020 10:49:30 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20(#379)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Paths.ts | 4 ++-- src/__tests__/Paths.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Paths.ts b/src/Paths.ts index 5235e39b..719036e1 100644 --- a/src/Paths.ts +++ b/src/Paths.ts @@ -33,8 +33,8 @@ export type Path = { export const serialize = (path: Path) => { "worklet"; return `M${path.move.x},${path.move.y} ${path.curves - .map((c) => `C${c.c1.x},${c.c1.y} ${c.c2.x},${c.c2.y} ${c.to.x},${c.to.y} `) - .reduce((acc, c) => acc + c)}${path.close ? "Z" : ""}`; + .map((c) => `C${c.c1.x},${c.c1.y} ${c.c2.x},${c.c2.y} ${c.to.x},${c.to.y}`) + .join(" ")}${path.close ? "Z" : ""}`; }; /** diff --git a/src/__tests__/Paths.test.ts b/src/__tests__/Paths.test.ts index e7ab0af6..8a918be4 100644 --- a/src/__tests__/Paths.test.ts +++ b/src/__tests__/Paths.test.ts @@ -36,7 +36,7 @@ const points: Vector[] = [ test("parse()", () => { const path = - "M150,0 C150,0 0,75 200,75 C75,200 200,225 200,225 C225,200 200,150 0,150 "; + "M150,0 C150,0 0,75 200,75 C75,200 200,225 200,225 C225,200 200,150 0,150"; expect(serialize(parse(path))).toBe(path); });