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 with initial value #79

Merged
merged 3 commits into from Oct 31, 2016
Merged

reduce with initial value #79

merged 3 commits into from Oct 31, 2016

Conversation

dominictarr
Copy link
Member

I was about to merge @kemitchell's pr #77
but it was bugging me that there where two completely separate code paths, and that it added trippled the number of lines.

This takes a different style, the main thing, is that if acc is not provided, it treats the first item as a special case, then falls back to the main way. I feel that this is more the pull-stream way

I also changed the way variable arguments where handled, there are lots of ways to do this... This is just the way that I always do it, which i learned from isaacs back in the day, eg

@kemitchell
Copy link
Contributor

Should have mentioned this weekend's handiwork here: https://www.npmjs.com/package/pull-reduction

@kemitchell
Copy link
Contributor

I ended up doing this: https://github.com/kemitchell/pull-reduction.js/blob/727f96ac0b95ae59f17c47988258560d36622682/index.js#L90

But please feel free to take whatever you can from this PR! It is a humble offering. No feelings will be trampled in any event.

@dominictarr dominictarr merged commit 6c5caa6 into master Oct 31, 2016
@staltz staltz deleted the preread_reduce branch May 5, 2021 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants