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

takeWhile(f) added, issues #378, #675 #677

Merged
merged 8 commits into from
Mar 27, 2019
Merged

takeWhile(f) added, issues #378, #675 #677

merged 8 commits into from
Mar 27, 2019

Conversation

mauriciocap
Copy link
Contributor

As suggested in #675 and #378

lib/index.js Outdated
catch (e) {
fnErr = e;
}
if (fnVal) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reverse this.

if (fnErr) {
  ...
  next();
} else if (fnVal) {
  ...
  next();
} else {
  push(null, nil);
}

You want to check for fnErr first, since you need to push nil if fnVal is false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

test/test.js Show resolved Hide resolved
lib/index.js Outdated
* @throws {TypeError} if `f` is not a function.
* @api public
*
* _([1, 2, 3, 4]).takeWhile(x => x<3) // => 1, 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* _([1, 2, 3, 4]).takeWhile(x => x<3) // => 1, 2
* _([1, 2, 3, 4]).takeWhile(x => x < 3) // => 1, 2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Copy link
Collaborator

@vqvu vqvu left a comment

Choose a reason for hiding this comment

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

Please also add an entry to the CHANGELOG.md for 3.0.0-beta.10. Use the format of the previous entries.

lib/index.js Outdated Show resolved Hide resolved
@vqvu vqvu merged commit e504b42 into caolan:master Mar 27, 2019
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.

2 participants