Skip to content

core: inline single-use helpers updateArrayItem and updateShallowProperty #66

@nerdalytics

Description

@nerdalytics

Finding

Two helper functions in src/index.ts are each called exactly once:

  • updateArrayItem (lines 298-304) — called at line 343
  • updateShallowProperty (lines 307-317) — called at line 364

Both are two-line operations: spread-copy, then assign at index/key. The indirection adds cognitive overhead without reuse benefit.

Proposed fix

Inline both at their single call sites:

updateArrayItem becomes const copy = [...arr]; copy[index] = value; return copy

updateShallowProperty becomes const result = { ...obj }; result[key] = value; return result

Remove both helper functions.

Source: out/report-simplify.txt, Findings 5 + 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions