jay-framework / jay-framework/jay
forEach directive
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 3
- Avg merge
- 11m
- Merged PRs (30d)
- 5
Description
There are few things that I consider for the forEach directive:
- Assume the forEach will not built only for arrays but for any iterable(Map, Set, generator) if then it's might be good to consider less verbose approach (with many attributes like
index,key,item) - The item={item} is something different from other directives because it's defining a scoped variable and not using one.
- Access the index of the iteration might also be important (not printing the last divider)
- Not sure about async iterations but it can be also supported
Maybe embrace the JS syntax for of that when the left side if the of is always a const it's. with some sugar for the index.
<div for="items" trackBy={expr}></div> - cool auto destructure
<div for="item of items" trackBy={expr}></div>
<div for="[key, value] of items" trackBy={expr}></div>
<div for="[index, value] of items" trackBy={expr}></div>
<div for="[key, value, index] of items" trackBy={expr}></div> - index sugar
Async
<div for="await value of promises" trackBy={expr}></div>
Or
<div for-await="value of promises" trackBy={expr}></div>
Contributor guide
No contributing guide indexed for this repository
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 by locating the existing forEach directive and reviewing how its current item and index attributes are handled. Evaluate the proposed iterable, destructuring, index, tracking, and async forms; the issue is complete only once the supported syntax and behavior are defined and implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100