Skip to content

V2 - #164

Merged
KiraLT merged 14 commits into
mainfrom
v2
Jul 20, 2026
Merged

V2#164
KiraLT merged 14 commits into
mainfrom
v2

Conversation

@KiraLT

@KiraLT KiraLT commented Sep 15, 2025

Copy link
Copy Markdown
Owner

No description provided.

@KiraLT KiraLT linked an issue Sep 15, 2025 that may be closed by this pull request
17 tasks
Copilot AI review requested due to automatic review settings September 23, 2025 10:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request represents a major migration from V1 to V2 of the library, introducing comprehensive changes to improve the development experience, modernize tooling, and add new functionality.

  • Migration from Jest to Node.js native test runner with built-in coverage support
  • Complete replacement of build tooling from Microbundle to TypeScript compiler with explicit file extensions
  • Addition of new iterable module with universal reduce function and new outdent template literal function

Reviewed Changes

Copilot reviewed 36 out of 39 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
package.json Updated build tooling, test setup, and dependencies for V2 migration
biome.json Added Biome for code formatting and linting
src/iterable.ts New module with universal reduce function for sync/async iterables
src/string.ts Added outdent function for removing leading indentation from template literals
src/guards.ts Enhanced with new type guards and updated to use modern JavaScript methods
spec/*.spec.ts Migrated all tests from Jest to Node.js native test runner
src/*.ts Updated import statements to use explicit .ts file extensions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/string.ts
Comment on lines +163 to +165
* @param strings
* @param values
* @returns

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc parameters lack descriptions. Add proper descriptions for strings (TemplateStringsArray), values (interpolated values), and @returns (processed string with indentation removed).

Suggested change
* @param strings
* @param values
* @returns
* @param strings The array of string literals from the template (TemplateStringsArray).
* @param values The interpolated values within the template.
* @returns The processed string with indentation removed.

Copilot uses AI. Check for mistakes.
Comment thread src/object.ts
const numKey = parseInt(key.toString(), 10)

return isNaN(numKey)
return Number.isNaN(numKey)

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Good improvement replacing the global isNaN with Number.isNaN which provides more precise NaN checking without type coercion.

Copilot uses AI. Check for mistakes.
Comment thread src/guards.ts
Comment on lines 254 to +257
export function ensureArray<T>(value: T | T[]): T[]
export function ensureArray<T>(value: T | ReadonlyArray<T>): ReadonlyArray<T>
export function ensureArray<T>(value: T | readonly T[]): ReadonlyArray<T> {
return value instanceof Array ? value : [value]
return Array.isArray(value) ? value : [value as T]

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type assertion as T could potentially mask type errors. Consider using a more explicit type guard or ensuring the generic constraint is properly defined to avoid unsafe casting.

Copilot uses AI. Check for mistakes.
Comment thread src/guards.ts Outdated
T extends unknown,
Key extends string | number | symbol,
>(
export function hasKeys<T, Key extends string | number | symbol>(

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Good simplification of the generic constraint from T extends unknown to just T, which is more concise and equally effective.

Copilot uses AI. Check for mistakes.
Comment thread src/http/codes.ts
@@ -9,343 +9,343 @@
*
* @group Http

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting from enum to const objects is a breaking change that affects how these values are imported and used. Consider documenting this breaking change and providing migration guidance for users upgrading from V1.

Suggested change
* @group Http
* @group Http
*
* @remarks
* **Breaking Change in V2:** `HttpStatusCodes` was previously exported as a TypeScript `enum` in V1. It is now exported as a `const` object.
* - **Migration:** Update your imports and usage from `import { HttpStatusCodes } from ...` and `HttpStatusCodes.ACCEPTED` to the same property access, but note that reverse mapping (e.g., `HttpStatusCodes[202]`) is no longer supported.
* - If you relied on enum-specific features, refactor your code to use the object properties directly.

Copilot uses AI. Check for mistakes.
Comment thread src/http/codes.ts
Comment on lines +362 to 363
export const HttpStatusReasons = {
/**

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting from enum to const objects is a breaking change that affects how these values are imported and used. Consider documenting this breaking change and providing migration guidance for users upgrading from V1.

Suggested change
export const HttpStatusReasons = {
/**

Copilot uses AI. Check for mistakes.
Comment thread src/array.ts
Comment on lines +605 to 606
* @param compare find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,

Copilot AI Sep 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name in the documentation (compare) doesn't match the actual parameter name in the function signature. This should be consistent with the implementation.

Suggested change
* @param compare find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* @param compare `compare` is called once for each element of the array, in ascending
* order, until it returns true. If such an element is found,

Copilot uses AI. Check for mistakes.
Comment thread spec/encoding.spec.ts
writable: true,
})
try {
const uuid = generateUUID()
@KiraLT
KiraLT merged commit 9deba7e into main Jul 20, 2026
4 of 5 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 20, 2026
# [2.0.0](v1.11.2...v2.0.0) (2026-07-20)

* V2 ([#164](#164)) ([9deba7e](9deba7e))

### BREAKING CHANGES

* * ESM-only. CJS/UMD entry points removed; require("common-stuff") no longer works.
httpErrorHandler removed — inline the middleware (it was a thin instanceof HttpError wrapper).
* HttpStatusCodes / HttpStatusReasons are const objects, not enums (required by erasableSyntaxOnly). Value reads are unchanged; the type HttpStatusCodes is gone — use (typeof HttpStatusCodes)[keyof typeof HttpStatusCodes] if needed.
* Array-only flatMap removed. The universal flatMap (iterable module) requires callbacks to return an iterable and only passes (item, index).
* parseSize returns number | undefined instead of -1.
* merge<A, B>(target, source): A & B — return type is inferred. Explicit merge<MyShape>(a, b) calls need to pass both generics or cast.
* hashCode integers changed (prefixed with typeof to avoid falsy collisions). Invalidate any persisted hashes.
* difference / intersection / union / shuffle now correctly return T[] for mutable inputs (v1 always returned ReadonlyArray<T> due to overload order).
* isArray narrows readonly inputs to ReadonlyArray<T> (v1 narrowed them to mutable Array<T>); runtime switched to * * Array.isArray (fixes cross-realm).
* getByKey infers the return type from literal paths. Pass T explicitly for dynamic paths.
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Universal helpers for all iterable data structures

3 participants