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

adds 'core/last' emitting the last event. Useful for reduce/fold too. #673

Closed
wants to merge 3 commits into from

Conversation

semmel
Copy link
Contributor

@semmel semmel commented Feb 7, 2024

I sometimes need the last value in a stream or reduce it to the last value of scan

I could not find a way to do that with the existing API.

What do you think?

Also adds (helper function) prelude/flow to support function pipelines (in tests)

@semmel
Copy link
Contributor Author

semmel commented Feb 7, 2024

I guess, Circle CI fails because one needs to npm install --legacy-peer-deps to install the project. npm install no longer works for me (npm v9.8).

@TylorS
Copy link
Member

TylorS commented Feb 8, 2024

We'll have to look into updating the build (hasn't been a need for a long time), but for this operator specifically, there's already a 3rd party library for this -

https://github.com/mostjs-community/last

@semmel
Copy link
Contributor Author

semmel commented Feb 8, 2024

We'll have to look into updating the build (hasn't been a need for a long time),

For the time being one could mention npm install --legacy-peer-deps in the Readme perhaps

but for this operator specifically, there's already a 3rd party library for this -

https://github.com/mostjs-community/last

That is awesome, but at the same time so sad that it seems I wasted all the time for this PR 😭

Nevermind, I know now about the implementation. That enables me to attempt Fantasy-Land support.
That's a whole other story, but I hate to repeat myself in each file's imports:

import {map , chain} from 'ramda'
import {map as map_o, chain as chain_o} from '@most/core'

@TylorS
Copy link
Member

TylorS commented Feb 8, 2024

We do really appreciate the effort, and apologize if it feels like a waste of your time. If you'd we so kind to separate the CI fixes, I'd most graciously accept those.

If you're looking for method extensions to Stream, you might find this useful for inspiration at least https://github.com/mostjs/x-fluent. We've avoided fluent APIs in core because they can't be removed during tree-shaking, but they definitely are convenient

@briancavalier
Copy link
Member

Hi @semmel. I'll echo @TylorS's apology for the effort you put into your last implementation. Thanks for letting us know about --legacy-peer-deps, and for attempting FL support. I'll take a look at #675.

That's a whole other story, but I hate to repeat myself in each file's imports

Using import * as M from '@most/core' is another option, if you don't mind namespace-style import.

@semmel semmel closed this Mar 9, 2024
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.

3 participants