From 836edf16ad4f0c3264e13ddad766aec8dd5ffbe3 Mon Sep 17 00:00:00 2001 From: Assayyaad Date: Mon, 15 Jul 2024 22:12:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=D8=AA=D8=B5=D9=84=D9=8A=D8=AD=20=D8=AF?= =?UTF-8?q?=D8=A7=D9=84=D8=A9=20=D8=A7=D9=84=D8=A5=D9=86=D8=B4=D8=A7=D8=A1?= =?UTF-8?q?=20=D9=88=D8=A8=D8=B9=D8=B6=20=D8=A7=D9=84=D8=A5=D8=AE=D8=AA?= =?UTF-8?q?=D8=A8=D8=A7=D8=B1=D8=A7=D8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/line/func/create.js | 2 +- tests/line/create.test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/line/func/create.js b/src/line/func/create.js index 8d50696..55735ef 100644 --- a/src/line/func/create.js +++ b/src/line/func/create.js @@ -24,7 +24,7 @@ * const line = Line.create.one({ spacing: 5, count: 3, neg: true }) * // line = { neg: true, count: 3, dis: 10, spacing: 5, end: -10, min: -10, max: 0, points: [0, -5, -10] } */ -export function one({ dis = 1, end = 1, spacing = 1, count = 2, neg = false }) { +export function one({ dis, end, spacing, count, neg = false }) { // التحقق من القيم المقدمة if (!Number.isNaN(dis) && dis < 0) throw new Error('يجب أن تكون المسافة موجباً') if (!Number.isNaN(spacing) && spacing < 0) throw new Error('يجب أن يكون التباعد موجباً') diff --git a/tests/line/create.test.js b/tests/line/create.test.js index 2b1a518..e97a25b 100644 --- a/tests/line/create.test.js +++ b/tests/line/create.test.js @@ -181,7 +181,7 @@ describe('5: اصنع نقاطاً على مستقيم', function () { // +2 * 1 = +2 // +3 * 1 = +3 - const pArr = Line.create.points(7) + const pArr = Line.create.points({ count: 7 }) deepStrictEqual(pArr, [0, 1, -1, 2, -2, 3, -3]) }) @@ -197,7 +197,7 @@ describe('5: اصنع نقاطاً على مستقيم', function () { // (+1 * 1) + +half_spacing = +1 + +0.5 = +1.5 // (+2 * 1) + +half_spacing = +2 + +0.5 = +2.5 - const pArr = Line.create.points(6) + const pArr = Line.create.points({ count: 6 }) deepStrictEqual(pArr, [0.5, -0.5, 1.5, -1.5, 2.5, -2.5]) }) @@ -212,7 +212,7 @@ describe('5: اصنع نقاطاً على مستقيم', function () { // +2 * 2 = +4 // +3 * 2 = +6 - const pArr = Line.create.points(7, 2) + const pArr = Line.create.points({ count: 7, spacing: 2 }) deepStrictEqual(pArr, [0, 2, -2, 4, -4, 6, -6]) }) @@ -228,7 +228,7 @@ describe('5: اصنع نقاطاً على مستقيم', function () { // (+1 * 2) + +half_spacing = -2 + +1 = +3 // (+2 * 2) + +half_spacing = -4 + +1 = +5 - const pArr = Line.create.points(6, 2) + const pArr = Line.create.points({ count: 6, spacing: 2 }) deepStrictEqual(pArr, [1, -1, 3, -3, 5, -5]) }) })