For beta 1#65
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors and expands equality/diff helpers across object/ and array/ for the “beta 1” milestone, replacing JSON-based comparisons with key/structural comparisons and introducing clearer API variants (equalsShallow, equalsDeep, diff, equalsUnordered).
Changes:
- Reworked
object/shallowEqualsandarray/shallowEqualsto use shallow element/key comparisons instead ofJSON.stringify. - Added new helpers:
object/{equalsShallow,equalsDeep,diff}andarray/{equalsShallow,equalsDeep,equalsUnordered}, plus corresponding tests/specs/examples/benches. - Renamed/removed older helpers (
object/deepCompare,array/equals) and updated references.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| helpers/object/shallowEquals.ts | Replaces JSON stringify comparison with shallow key/value equality + updated JSDoc. |
| helpers/object/shallowEquals.test.ts | Updates unit tests to match new shallow object equality semantics. |
| helpers/object/equalsShallow.ts | New shallow object equality helper (currently duplicated logic). |
| helpers/object/equalsShallow.test.ts | Unit tests for equalsShallow. |
| helpers/object/equalsShallow.spec.ts | Property/contract specs updated to equalsShallow (wording still references JSON). |
| helpers/object/equalsShallow.example.ts | Example updated to new helper name (description still mentions JSON.stringify). |
| helpers/object/equalsDeep.ts | Adds boolean wrapper around diff. |
| helpers/object/equalsDeep.test.ts | Unit tests for deep object equality wrapper. |
| helpers/object/equalsDeep.spec.ts | Property-based tests for deep object equality wrapper. |
| helpers/object/equalsDeep.example.ts | Adds examples for deep equality wrapper. |
| helpers/object/diff.ts | Introduces structural diff with depth option (not cycle-safe; key handling needs hardening). |
| helpers/object/diff.test.ts | Migrates deepCompare tests to diff and adds depth-option coverage. |
| helpers/object/diff.spec.ts | Property/contract specs migrated to diff (one test title inconsistent). |
| helpers/object/diff.example.ts | Updates examples to use diff. |
| helpers/object/diff.bench.ts | Updates benchmark to use diff. |
| helpers/object/deepCompare.ts | Removes old deepCompare implementation. |
| helpers/array/shallowEquals.ts | Replaces JSON stringify comparison with positional === shallow equality. |
| helpers/array/shallowEquals.test.ts | Removes unit tests for array/shallowEquals. |
| helpers/array/equalsUnordered.ts | Adds order-independent array equality (current algorithm mishandles duplicates). |
| helpers/array/equalsUnordered.test.ts | Updates tests to new helper name (formatting differs from repo conventions). |
| helpers/array/equalsUnordered.spec.ts | Adds property/contract specs for unordered equality. |
| helpers/array/equalsUnordered.example.ts | Updates examples to new helper name. |
| helpers/array/equalsShallow.ts | Adds named shallow array equality helper (duplicates shallowEquals). |
| helpers/array/equalsShallow.test.ts | Adds unit tests for equalsShallow. |
| helpers/array/equalsShallow.spec.ts | Updates spec to new helper name (comments still reference JSON.stringify). |
| helpers/array/equalsShallow.example.ts | Updates examples to new helper name (descriptions still reference JSON/old helper names). |
| helpers/array/equalsDeep.ts | Adds recursive deep array equality helper (appears duplicated with deepEquals). |
| helpers/array/equalsDeep.test.ts | Adds unit tests for deep array equality. |
| helpers/array/equalsDeep.spec.ts | Updates property/contract specs to use equalsDeep. |
| helpers/array/equalsDeep.example.ts | Updates examples to use equalsDeep. |
| helpers/array/equalsDeep.bench.ts | Updates benchmark to use equalsDeep. |
| helpers/array/equals.ts | Removes old unordered equality helper. |
| helpers/array/equals.spec.ts | Removes specs for old equals. |
| helpers/array/deepEquals.ts | Upgrades existing deep array equality to recursive structural comparison. |
| helpers/array/deepEquals.test.ts | Updates tests to cover recursive structural behavior. |
Comments suppressed due to low confidence (6)
helpers/array/equalsShallow.example.ts:26
- The example description mentions JSON.stringify and refers to “equals”, but
equalsShallowis now an index-by-index===comparison and the relevant contrasting helper isequalsUnordered. Please update the descriptions to reflect the current behavior and names.
helpers/object/equalsShallow.example.ts:17 - The example description still claims JSON.stringify-based comparison, but
equalsShallownow does key/value checks and no longer stringifies. Please update the example text to match the current implementation/semantics (and note any important caveats, like nested objects being compared by reference).
helpers/array/equalsShallow.spec.ts:61 - Several comments in this spec still explain behavior in terms of JSON.stringify (e.g. for functions), but
equalsShallowno longer uses JSON serialization. Please update the commentary so the spec documents the actual algorithm/contract being tested.
helpers/object/equalsShallow.spec.ts:90 - Several test names/comments still refer to JSON.stringify/try-catch behavior, but
equalsShallowno longer uses JSON serialization. Updating the wording would prevent confusion and ensure the contract/spec reflects the actual algorithm being tested.
helpers/array/equalsUnordered.test.ts:12 - Code style: CONTRIBUTING.md calls for single quotes and 2-space indentation in this repo, but this test file uses double quotes and 4-space indentation. Aligning with the repo conventions will keep formatting consistent across helpers.
helpers/object/diff.spec.ts:51 - The test title says “null vs null → false …” but the assertion (and the inline comment) expect
true. Please correct the title so it matches the actual expected behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 194 out of 199 changed files in this pull request and generated 16 comments.
Comments suppressed due to low confidence (2)
helpers/object/equalsShallow.example.ts:18
- The example description says it “Uses JSON.stringify”, but
equalsShallowis implemented via key enumeration +===checks (no stringify). Update the description so it matches the actual algorithm/semantics.
helpers/array/equalsShallow.example.ts:18 - The description claims
equalsShallow“Uses JSON.stringify”, but the implementation is an element-by-element===loop. Update the example text to avoid misleading users about behavior (notablyNaNand nested reference semantics).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daf0e32 to
385ad68
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 197 out of 202 changed files in this pull request and generated 10 comments.
Comments suppressed due to low confidence (2)
helpers/object/equalsShallow.example.ts:17
- The description still claims this uses
JSON.stringify, butequalsShallowis now a key/value strict-equality check (no serialization). Update the example description to match the actual algorithm/behavior.
helpers/array/equalsShallow.example.ts:17 - The description still claims this uses
JSON.stringify, butequalsShallowis now a positional strict-equality check (no serialization). Update the example description to match the actual algorithm/behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 197 out of 202 changed files in this pull request and generated 9 comments.
Comments suppressed due to low confidence (5)
helpers/array/intersects.ts:17
- The JSDoc text has a few grammar issues ("check" → "checks", "shared" → "share", "at least an item" → "at least one item") and the
returnline is indented with 4 spaces rather than the repo’s 2-space indentation convention (AGENTS.md:142).
helpers/array/equalsUnordered.test.ts:13 - This test file doesn’t follow the repo’s formatting conventions (single quotes + 2-space indentation; AGENTS.md:142). Please reformat (imports use double quotes and the body is indented with 4 spaces).
helpers/array/intersects.test.ts:22 - Indentation in this test file is 4 spaces, but the repo convention is 2 spaces (AGENTS.md:142). Since this hunk is already being edited for the rename, please reformat the block for consistency.
helpers/object/equalsShallow.example.ts:18 - The example description says this helper "Uses JSON.stringify", but
equalsShallownow does a key-by-key===comparison (no JSON serialization). Please update the description to match the implementation to avoid misleading docs.
helpers/array/equalsShallow.example.ts:18 - The example description claims
equalsShallowusesJSON.stringify, but the current implementation does a positional===loop (no JSON serialization). Please update the description so docs match behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 197 out of 202 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (3)
helpers/object/equalsShallow.example.ts:17
- The example description says this uses
JSON.stringify, butequalsShallownow does a key-by-key shallow comparison. Please update the description to match the current implementation so the docs don’t mislead users.
helpers/array/equalsShallow.example.ts:17 - The example description mentions
JSON.stringify, butarray/equalsShallowis implemented as an index-by-index===comparison (no JSON serialization). Updating the description will keep the docs accurate.
helpers/array/intersects.ts:17 - Renaming the exported function from
oneInCommontointersectsis a breaking API change for consumers importingoneInCommon. If you still want to standardize onintersects, consider re-exportingoneInCommonas an alias (potentially deprecated) to preserve compatibility.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- delete deepEquals function and its tests - delete equals function and its tests - add equalsDeep for recursive structural equality - add equalsShallow for positional one-level equality - add equalsUnordered for order-independent equality - add tests and examples for new equality functions
- implement `equalsDeep` for recursive structural equality - implement `equalsShallow` for one-level equality - add tests for both equality functions - add examples for usage of equality functions
- delete uuid7.example.ts - delete uuid7.spec.ts - delete uuid7.test.ts - delete uuid7.ts - delete config.json
- add uuid7 function for generating UUID v7 strings - create uuid7 example file with usage examples - implement uuid7 tests for validation and uniqueness - update settings to include 'id' scope
- change import from './types.model' to './types' in multiple files - remove obsolete types.model.ts file chore(type): 🔧 move Maybe type to its own file - create Maybe.ts and update import in isDefined.ts - remove Maybe.model.ts file
…onventions Co-authored-by: Copilot <copilot@github.com>
- add lowercaseRest option to preserve original casing - update examples and tests for new functionality
Co-authored-by: Copilot <copilot@github.com>
- implement escape function for Markdown special characters - add property-based tests for escape function - create examples for escape usage
- implement escapeTableCell for Markdown table cell safety - add examples for escapeTableCell usage - create property-based tests for escapeTableCell - add unit tests for escapeTableCell functionality
- implement statusToBadge for CI status mapping - implement statusToIcon for CI status emoji representation - add examples and tests for both functions
- implement buildStatusTable for generating Markdown table rows - add property-based tests for buildStatusTable - add unit tests for buildStatusTable functionality
- enhance escape function to handle pipe and newline characters - remove escapeTableCell function and related tests/examples Co-authored-by: Copilot <copilot@github.com>
- implement leadingSentence function to extract the first sentence - add examples for various sentence structures - create property-based tests for leadingSentence function - add unit tests for leadingSentence function
- implement flip function to swap first two arguments - add examples for subtraction and division - create property-based tests for flip functionality - add unit tests for various use cases
- implement negate function to return logical negation of predicates - add examples for usage in filtering and deriving predicates - create property-based tests for negate functionality
- implement linear interpolation function - add example usage in lerp.example.ts - add property-based tests in lerp.spec.ts - add unit tests in lerp.test.ts
- implement formatCompact for compact number formatting - add examples for English and French locales - create property-based tests for formatCompact - add unit tests for various number formats
- implement template function for string interpolation - add examples for usage - create property-based and unit tests for template function
- add union example with lodash and ramda - add select/filterMap example with radashi
- implement cartesian product logic - add examples in cartesianProduct.example.ts - add property-based tests in cartesianProduct.spec.ts - add unit tests in cartesianProduct.test.ts
- implement defer function for LIFO callback execution - add examples in defer.example.ts - add property-based tests in defer.spec.ts - add unit tests in defer.test.ts Co-authored-by: Copilot <copilot@github.com>
- fix(array): make zip implementation accept readonly arrays - fix(promise): add missing resolveRecord import in example - fix(promise): wrap Array.push callbacks to return void in defer tests - fix(object): use flatMap to avoid possibly-undefined in groupBy.spec - fix(object): use string keys in invert example to fix type mismatch - fix(examples): add missing description field to 14 ExampleDefinition entries
- fix(build): convert 11 plain-script example files to HelperExamples format (defer, cartesianProduct, countBy, without, flip, negate, formatCompact, lerp, escapeHtml, template, words) — loadExampleFiles crashed on missing default export - fix(number): lerp early-return for t=0 and t=1 to preserve -0 sign identity
- assert version matches root package.json - validate build date is present and parseable - check totalCategories against actual category directories - verify categories list matches actual directories - ensure packages metadata count matches expected - clarify index.ts re-export check is not needed - throw error on dependency version mismatch - fail on suspiciously small packages (<1KB) Co-authored-by: Copilot <copilot@github.com>
Description
Please include a summary of what this PR does and why it's needed.
Type of Change
Related Issues
Closes #(issue number)
How Has This Been Tested?
Describe the tests you ran and how to reproduce them:
Checklist
Screenshots (if applicable)
Add screenshots for UI changes.
Additional Context
Add any other context about the PR here.