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

meta: callback checking is inconsistent across lib #3536

Closed
MylesBorins opened this issue Oct 26, 2015 · 5 comments
Closed

meta: callback checking is inconsistent across lib #3536

MylesBorins opened this issue Oct 26, 2015 · 5 comments
Labels
meta Issues and PRs related to the general management of the project.

Comments

@MylesBorins
Copy link
Contributor

Throughout the codebase there are two altering ways that callbacks are checked.

In some instances it is checked for truthyness

if (callback)
    process.nextTick(callback)

Where in others it is explicitly checked

if (typeof callback === 'function')
    process.nextTick(callback)

Hopefully this is not opening too large a bike shed, but I was curious if their is a legitimate benefit to using both.

@Fishrock123
Copy link
Contributor

We should prefer the latter but there are some cases where that breaks odd things, iirc.

@cjihrig
Copy link
Contributor

cjihrig commented Oct 26, 2015

I was curious if their is a legitimate benefit to using both.

There is a legitimate reason to check for typeof === 'function'. Trying to call anything else will blow up.

@MylesBorins
Copy link
Contributor Author

If that is the case would it not make sense to change all of the instances that do otherwise and mark it semver-major?

@cjihrig
Copy link
Contributor

cjihrig commented Oct 27, 2015

My opinion would be yes, but I'm not sure about the semver-major. I can't think of anything that could break from such a change (although I could easily be wrong).

@Trott Trott added the meta Issues and PRs related to the general management of the project. label Feb 3, 2016
@MylesBorins
Copy link
Contributor Author

I'm not sure this is worth pursuing, going to close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

No branches or pull requests

4 participants