From 5bdf0cdb3a444304c86d122be743ce06d19f0bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Carmo?= Date: Sat, 4 Apr 2026 14:52:58 +0100 Subject: [PATCH] refactor: remove unused tail and debugPrint functions and update React peer dependency Remove tail function and its test as they are no longer used in the codebase. Remove debugPrint function which is redundant. Update React peer dependency to only support version 19 to align with current project requirements. --- lib/helpers/functions.helpers.test.ts | 8 -------- lib/helpers/functions.ts | 8 -------- package.json | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/helpers/functions.helpers.test.ts b/lib/helpers/functions.helpers.test.ts index 32ba457..75e0ec0 100644 --- a/lib/helpers/functions.helpers.test.ts +++ b/lib/helpers/functions.helpers.test.ts @@ -1,6 +1,5 @@ import { head, - tail, isString, isArray, isObject, @@ -40,13 +39,6 @@ test('head(), should return the first element in an array', () => { expect(head(randArr)).toBe(randVal) }) -test('tail(), should return the last element in an array', () => { - const randArr = Array(getRandomInt(100)) - const randVal = getRandomInt(100) - randArr[randArr.length - 1] = randVal - expect(tail(randArr)).toBe(randVal) -}) - describe('isString(), should be true only for strings', () => { test.each(objectTypesTests)('Testing %s', (type, value) => { expect(type !== 'string' || (type === 'string' && isString(value))).toBe( diff --git a/lib/helpers/functions.ts b/lib/helpers/functions.ts index d34adef..0e25651 100644 --- a/lib/helpers/functions.ts +++ b/lib/helpers/functions.ts @@ -82,8 +82,6 @@ export interface FetchDataOptions { export const head = ([first]: T[]): T => first -export const tail = (arr: T[]): T => arr[arr.length - 1] - export const isString = (str: unknown): boolean => typeof str === 'string' || str instanceof String @@ -154,12 +152,6 @@ export const sortBy = ( export const cleanLonelyInt = (val: string): boolean => !(val && /^\d+$/.test(val)) -export const debugPrint = (...args: unknown[]): void => { - if (process.env.NODE_ENV !== 'production') { - console.log(...args) - } -} - export const errorPrint = (...args: unknown[]): void => { console.error(...args) } diff --git a/package.json b/package.json index 6793096..7c3953e 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "linkifyjs": "^4.3.2" }, "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + "react": "^19.0.0" }, "devDependencies": { "@eslint-react/eslint-plugin": "^4.2.3",