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

*Seq methods #8

Open
RobertFischer opened this issue Nov 28, 2020 · 1 comment
Open

*Seq methods #8

RobertFischer opened this issue Nov 28, 2020 · 1 comment
Labels
enhancement New feature or request iterables For iterable methods (aka: collection methods)

Comments

@RobertFischer
Copy link
Owner

This was documented, but they don't exist anymore...

Collection Methods and *Seq Methods

There are a number of collection methods provided, such as fold, map, and
filter. These methods assume that they are acting on a
FunPromise<T extends Iterable<U>>, and the type system will ensure that you
are if you're using Typescript: attempts to call those functions on something
that is not Iterable will end up with a return type of FunPromise<never>.
If, however, you circumvent the typing (eg: by using JavaScript to call the
method), then the resolved value of the FunPromise will be cast to an array
using _.castArray from Lodash,
which probably does what you want.

There are also methods whose names end in *Seq. These methods also operate on
a FunPromise<T extends Iterable<U>>. They are functionally identical to their
Seq-less counterparts, but with one additional guarantee: the first element of
the iterable will be forced to resolve and will be processed before ever looking
at the second element, and so on. This may be useful for debugging or other
times when you are particular about making sure one thing works before the next
occurs.

@RobertFischer RobertFischer added enhancement New feature or request iterables For iterable methods (aka: collection methods) labels Nov 28, 2020
@RobertFischer
Copy link
Owner Author

It might be better to implement this as a subclass of FunPromise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request iterables For iterable methods (aka: collection methods)
Projects
None yet
Development

No branches or pull requests

1 participant