Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy Array Methods #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions proposal-template.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
# ECMAScript proposal: @Name
# ECMAScript proposal: Lazy Array Methods
- [Motivation](#motivation)
- [High-level API](#high-level-api)
- [FAQ](#faq)

## Motivation

Proposal motivation
When you use chain of default declarative array methods like `map`, `filter`, `reduce` and etc we will have acutaly multiple iterations around array.
I propose make tranduced API for default methods which actualy chain of methods will iterate only once.

## High-level API

```js
// example code
const users = [{ id: 0, name: "User", friends: [] }] // A lot of users
users
.lazy
.map(user => ({ id: user.id, user: user.name, friendCounts: friends.length }))
.filter(user => user.friendCounts > 10)
.map(user => user.id)
```

Will iterate once and implements wia reduce or iterator

### FAQ
#### Question

Expand Down