From d38923c4ad3a2cf8872e236dd42f078e2a0e1045 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Tue, 9 Feb 2021 19:40:02 +0100 Subject: [PATCH] Added card generation speed tests (part 2) ref #14 --- src/tests/speedtest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/speedtest.ts b/src/tests/speedtest.ts index aefb2a1..0ed4372 100644 --- a/src/tests/speedtest.ts +++ b/src/tests/speedtest.ts @@ -56,11 +56,11 @@ function idToEan13(id): string { while (id.length < 12) { id = '0' + id; } let total = 0; - this.id.split('').forEach((letter, index) => { + id.split('').forEach((letter, index) => { total += parseInt(letter, 10) * multiply[index % 2]; }); const checkSum = (Math.ceil(total / 10) * 10) - total; - return this.id + checkSum.toString(); + return id + checkSum.toString(); } async function postContracts(runners: Runner[]): Promise {