diff --git a/.gitignore b/.gitignore index c75ce47880..d2abfb3014 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .DS_Store -.env +.env* .eslintcache .idea .log diff --git a/test/utils/common-utils.js b/lib/utils/common-utils.test.ts similarity index 95% rename from test/utils/common-utils.js rename to lib/utils/common-utils.test.ts index 37c355580d..2dd667d68a 100644 --- a/test/utils/common-utils.js +++ b/lib/utils/common-utils.test.ts @@ -1,4 +1,5 @@ -const utils = require('../../lib/utils/common-utils'); +import { describe, expect, it } from '@jest/globals'; +import utils from './common-utils'; describe('common-utils', () => { it('toTitleCase', () => { diff --git a/lib/utils/common-utils.ts b/lib/utils/common-utils.ts index 8ef37f1b90..e89ee3fa14 100644 --- a/lib/utils/common-utils.ts +++ b/lib/utils/common-utils.ts @@ -8,14 +8,14 @@ const rWhiteSpace = /\s+/; const rAllWhiteSpace = /\s+/g; // collapse all whitespaces into a single space (like "white-space: normal;" would do), and trim -const collapseWhitespace = (str: string) => { +const collapseWhitespace = (str?: string | null) => { if (str && rWhiteSpace.test(str)) { return str.replaceAll(rAllWhiteSpace, ' ').trim(); } return str; }; -const convertDateToISO8601 = (date: string | Date | number) => { +const convertDateToISO8601 = (date?: string | Date | number | null) => { if (!date) { return date; }