Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "H4",
"name": "H4 Typescript",
"image": "mcr.microsoft.com/devcontainers/typescript-node:24",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
Expand Down Expand Up @@ -28,4 +28,4 @@
"onAutoForward": "notify"
}
}
}
}
47 changes: 47 additions & 0 deletions .devcontainer/workflow.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Run echo "Running strict security audit..."
Running strict security audit...
Audit level: low
┌─────────────────────┬────────────────────────────────────────────────────────┐
│ high │ Vite Vulnerable to Arbitrary File Read via Vite Dev │
│ │ Server WebSocket │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Package │ vite │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Vulnerable versions │ >=8.0.0 <=8.0.4 │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Patched versions │ >=8.0.5 │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Paths │ .>vite │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ More info │ https://github.com/advisories/GHSA-p9ff-h696-f583 │
└─────────────────────┴────────────────────────────────────────────────────────┘
┌─────────────────────┬────────────────────────────────────────────────────────┐
│ high │ Vite: `server.fs.deny` bypassed with queries │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Package │ vite │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Vulnerable versions │ >=8.0.0 <=8.0.4 │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Patched versions │ >=8.0.5 │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Paths │ .>vite │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ More info │ https://github.com/advisories/GHSA-v2wj-q39q-566r │
└─────────────────────┴────────────────────────────────────────────────────────┘
┌─────────────────────┬────────────────────────────────────────────────────────┐
│ moderate │ Vite Vulnerable to Path Traversal in Optimized Deps │
│ │ `.map` Handling │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Package │ vite │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Vulnerable versions │ >=8.0.0 <=8.0.4 │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Patched versions │ >=8.0.5 │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Paths │ .>vite │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ More info │ https://github.com/advisories/GHSA-4w7w-66w2-5vf9 │
└─────────────────────┴────────────────────────────────────────────────────────┘
3 vulnerabilities found
Severity: 1 moderate | 2 high
Error: Process completed with exit code 1.
66 changes: 0 additions & 66 deletions .eslintrc.json

This file was deleted.

39 changes: 39 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"typescript",
"unicorn",
"import",
"jsdoc",
"oxc"
],
"categories": {
"correctness": "error"
},
"rules": {
"no-explicit-any": "warn",
"sort-imports": "warn",
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
]
},
"overrides": [
{
"files": ["**/*.test.ts", "**/*.spec.ts", "**/*.bench.ts", "**/*.example.ts"],
"rules": {
"no-explicit-any": "off"
}
}
],
"ignorePatterns": [
"build",
"coverage",
"node_modules",
"reports",
".stryker-tmp"
]
}
2 changes: 1 addition & 1 deletion .template/category/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A set of helpers for working with URLs.

## Documentation

[https://helpers4.js.org/{{category}}](https://helpers4.js.org/{{category}})
[https://helpers4.dev/typescript/categories/{{category}}/](https://helpers4.dev/typescript/categories/{{category}}/)

<!-- AUTOMATIC-METHODS -->
- method
Expand Down
2 changes: 2 additions & 0 deletions .template/category/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"./examples.json": "./examples.json",
"./api.json": "./api.json",
"./licenses.json": "./licenses.json",
"./package.json": "./package.json"
},
"keywords": [
Expand All @@ -32,6 +33,7 @@
"lib/index.js.map",
"examples.json",
"api.json",
"licenses.json",
"LICENSE.md",
"package.json",
"README.md"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<p align="center">
<a href="https://www.npmjs.com/package/@helpers4/all"><img src="https://img.shields.io/npm/v/@helpers4/all?label=npm&color=cb3837" alt="npm version" /></a>
<a href="https://www.npmjs.com/package/@helpers4/all"><img src="https://img.shields.io/npm/v/@helpers4/all/alpha?label=pre-release&color=orange" alt="npm pre-release" /></a>
<a href="https://www.npmjs.com/package/@helpers4/all"><img src="https://img.shields.io/npm/dm/@helpers4/all?color=blue" alt="npm downloads" /></a>
<a href="https://github.com/helpers4/typescript/actions/workflows/release.yml"><img src="https://img.shields.io/github/actions/workflow/status/helpers4/typescript/release.yml?branch=main&label=release" alt="release status" /></a>
<a href="https://github.com/helpers4/typescript/blob/main/LICENSE"><img src="https://img.shields.io/github/license/helpers4/typescript?color=blue" alt="license" /></a>
Expand Down
2 changes: 1 addition & 1 deletion helpers/array/deepCompare.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import { describe, it, expect } from 'vitest';
import { describe, expect, it } from 'vitest';
import { deepCompare } from './deepCompare';

describe('deepCompare', () => {
Expand Down
2 changes: 1 addition & 1 deletion helpers/array/quickCompare.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import { describe, it, expect } from 'vitest';
import { describe, expect, it } from 'vitest';
import { quickCompare } from './quickCompare';

describe('quickCompare', () => {
Expand Down
2 changes: 1 addition & 1 deletion helpers/array/sort.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import { sortNumberAscFn, sortStringAscFn, createSortByStringFn } from './sort';
import { createSortByStringFn, sortNumberAscFn, sortStringAscFn } from './sort';
import type { HelperExamples } from '../../scripts/examples/types';

const examples: HelperExamples = {
Expand Down
8 changes: 4 additions & 4 deletions helpers/array/sort.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

import { describe, expect, it } from "vitest";
import {
createSortByDateFn,
createSortByNumberFn,
createSortByStringFn,
sortNumberAscFn,
sortNumberDescFn,
sortStringAscFn,
sortStringDescFn,
sortStringAscInsensitiveFn,
createSortByStringFn,
createSortByNumberFn,
createSortByDateFn
sortStringDescFn
} from "./sort";

describe("sort functions", () => {
Expand Down
4 changes: 2 additions & 2 deletions helpers/date/compare.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import { describe, it, expect } from 'vitest';
import { compare, DateCompareOptions } from './compare';
import { describe, expect, it } from 'vitest';
import { DateCompareOptions, compare } from './compare';

describe('compare', () => {
const date1 = new Date('2023-01-01T12:30:45.123Z');
Expand Down
2 changes: 1 addition & 1 deletion helpers/date/difference.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import { describe, it, expect } from 'vitest';
import { describe, expect, it } from 'vitest';
import { daysDifference } from './difference';

describe('daysDifference', () => {
Expand Down
2 changes: 1 addition & 1 deletion helpers/date/format.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import { toISO8601, toRFC3339, toRFC2822 } from './format';
import { toISO8601, toRFC2822, toRFC3339 } from './format';
import type { HelperExamples } from '../../scripts/examples/types';

const examples: HelperExamples = {
Expand Down
26 changes: 20 additions & 6 deletions helpers/date/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,26 @@ describe('toRFC2822', () => {
});

it('should handle different months', () => {
expect(toRFC2822('2025-02-15T12:00:00Z')).toBe(
'Sat, 15 Feb 2025 12:00:00 +0000'
);
expect(toRFC2822('2025-12-25T12:00:00Z')).toBe(
'Thu, 25 Dec 2025 12:00:00 +0000'
);
// Test all 12 months to kill month string mutations
const monthExpected = [
['2025-01-15', 'Jan'],
['2025-02-15', 'Feb'],
['2025-03-15', 'Mar'],
['2025-04-15', 'Apr'],
['2025-05-15', 'May'],
['2025-06-15', 'Jun'],
['2025-07-15', 'Jul'],
['2025-08-15', 'Aug'],
['2025-09-15', 'Sep'],
['2025-10-15', 'Oct'],
['2025-11-15', 'Nov'],
['2025-12-15', 'Dec'],
] as const;

for (const [dateStr, monthAbbr] of monthExpected) {
const result = toRFC2822(`${dateStr}T12:00:00Z`);
expect(result).toContain(monthAbbr);
}
});

it('should pad single digit days', () => {
Expand Down
20 changes: 19 additions & 1 deletion helpers/date/is.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/

import { describe, it, expect } from 'vitest';
import { describe, expect, it } from 'vitest';
import { isSameDay } from './is';

describe('isSameDay', () => {
Expand Down Expand Up @@ -59,4 +59,22 @@ describe('isSameDay', () => {
const utcEvening = new Date('2023-01-01T22:00:00.000Z');
expect(isSameDay(utcMorning, utcEvening)).toBe(true);
});

it('should return false for same month and day but different year', () => {
const date1 = new Date('2023-06-15T12:00:00.000Z');
const date2 = new Date('2024-06-15T12:00:00.000Z');
expect(isSameDay(date1, date2)).toBe(false);
});

it('should return false for same year and day but different month', () => {
const date1 = new Date('2023-03-15T12:00:00.000Z');
const date2 = new Date('2023-04-15T12:00:00.000Z');
expect(isSameDay(date1, date2)).toBe(false);
});

it('should return false for same year and month but different day', () => {
const date1 = new Date('2023-06-15T12:00:00.000Z');
const date2 = new Date('2023-06-16T12:00:00.000Z');
expect(isSameDay(date1, date2)).toBe(false);
});
});
16 changes: 14 additions & 2 deletions helpers/date/safeDate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { describe, expect, it } from "vitest";
import { safeDate, dateToISOString } from "./safeDate";
import { dateToISOString, safeDate } from "./safeDate";

describe("safe date utilities", () => {
describe("safeDate", () => {
Expand All @@ -20,11 +20,23 @@ describe("safe date utilities", () => {
expect(date).toBeInstanceOf(Date);
});

it("should return null for invalid inputs", () => {
it("should return null for null", () => {
expect(safeDate(null)).toBe(null);
});

it("should return null for undefined", () => {
expect(safeDate(undefined)).toBe(null);
});

it("should return null for empty string", () => {
expect(safeDate("")).toBe(null);
});

it("should return null for zero", () => {
expect(safeDate(0)).toBe(null);
});

it("should return null for invalid date string", () => {
expect(safeDate("invalid")).toBe(null);
});

Expand Down
Loading
Loading