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

Add and test empty method #657

Merged
merged 3 commits into from
Oct 27, 2018
Merged

Add and test empty method #657

merged 3 commits into from
Oct 27, 2018

Conversation

amsross
Copy link
Contributor

@amsross amsross commented Oct 25, 2018

empty creates a stream with no values.

This turns a Highland stream into a Monoid

@svozza
Copy link
Collaborator

svozza commented Oct 25, 2018

Don't Fantasyland method names need to be prefixed now? E.g., fantasyland/empty.

https://github.com/fantasyland/fantasy-land#prefixed-method-names

@amsross
Copy link
Contributor Author

amsross commented Oct 25, 2018

@svozza fantasyland prefixes are being added in #658. Since those don't currently exist in master, I'd prefer to add the functionality in this PR, merge to master, rebase #658 against those changes, and add the appropriate prefixes in that PR.

This also applies to #643.

lib/index.js Outdated
*/

addToplevelMethod('empty', function () {
return _([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this([]) instead of _([]).

There's a new feature in 3.0 (not yet documented) called use that lets you extend the stream prototype. Using this will make sure that you construct the new stream using the correct prototype.

Note that of has the same bug.

@vqvu
Copy link
Collaborator

vqvu commented Oct 27, 2018

Looks good!

@vqvu vqvu merged commit 1f7d9d0 into caolan:master Oct 27, 2018
@amsross amsross deleted the add-empty-method branch October 27, 2018 17:21
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