insert() should accept iterable collections, not only arrays
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36.1k
- Forks
- 1.1k
- Avg merge
- 9h 18m
- Merged PRs (30d)
- 195
Description
Moved from ryansolid/dom-expressions#294.
insert only walks arrays. A custom iterable of nodes (anything with Symbol.iterator that is not an array) is skipped with Unrecognized value. Skipped inserting. That shows up from non-JS producers (e.g. Squint) that hand JSX a collection rather than Array.from(...).
This is still real. It was never taken because walking general iterables on the insert hot path has a cost, and For / other list helpers would need the same treatment to be consistent.
Leaving it here as an enhancement for 2.x rather than a 1.x fix.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the insert implementation and compare its handling with For and other list helpers. Trace how a custom Symbol.iterator collection reaches insertion, then define completion as consistent iterable handling without regressing array behavior or overlooking the hot-path performance concern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100