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

reduce(f, init); transform(f, init); init can be a function #60

Closed
richytong opened this issue Jul 9, 2020 · 1 comment · Fixed by #62
Closed

reduce(f, init); transform(f, init); init can be a function #60

richytong opened this issue Jul 9, 2020 · 1 comment · Fixed by #62
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects

Comments

@richytong
Copy link
Collaborator

richytong commented Jul 9, 2020

Right now, init is a non-function value that I'm copying. I'd like the possibility for init to be a function. The init function would be a unary function that takes the current data payload and returns an initial value to be reduced. init can be async.

reduce(
  (a, b) => a + b,
  numbers => numbers[0],
)([1, 2, 3, 4, 5]) // 1 + 1 + 2 + 3 + 4 + 5

reduce(
  (a, b) => a + b,
  async numbers => numbers[0],
)([1, 2, 3, 4, 5]) // Promise { 1 + 1 + 2 + 3 + 4 + 5 }

this is important for issues like this

@richytong richytong added enhancement New feature or request help wanted Extra attention is needed labels Jul 9, 2020
@richytong richytong self-assigned this Jul 9, 2020
@richytong richytong added this to issues in v1.2.0 Jul 9, 2020
@richytong
Copy link
Collaborator Author

richytong commented Jul 11, 2020

starting on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
No open projects
v1.2.0
issues
Development

Successfully merging a pull request may close this issue.

1 participant