-
Notifications
You must be signed in to change notification settings - Fork 65
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
console.assert should return a boolean #63
Comments
Untested, proposed ES6 polyfill:
To remove the ES6 dependency:
|
In most cases would it not be cleaner to just assign the result of the conditional to a variable / constant and log/check that? |
@shelby3 And I would rather write |
I tend to agree with @Fishrock123 on this. I think there are valid cases for console methods to return a value (tracked here #75) and my thoughts on this are in #75 (comment), specifically point # 2. I could have an unpopular opinion on this but I think that this wouldn't be terribly useful/helpful, and furthermore is kind of non-obvious. It also feels weird to pepper my code/conditionals with
and Thoughts? |
My preference would be to avoid changing That might be a Console method or something else. |
That makes sense to me. It would also bring the browser's version of So while my opinion leans toward closing this, I wouldn't mind hearing from some implementers /cc @paulirish @JosephPecoraro @xirzec for some final feedback. |
We'd also prefer to keep |
Agreed, I'm going to close this issue. Thanks @shelby3 for filing, and providing the polyfill! |
I'm late to the party, but I'd prefer keeping it as-is as well. Folks have articulated some good arguments, and I have some selfish (implementation specific) reasons for preferring it to not return anything. |
Why should we decide what other programmers prefer in this case? What harm comes from giving them this choice?
That alternative would be okay with me. My brain can grok it either way.
Just curious why any of us should feel we should decide what other programmers want to use. Those who do not want to use the return value would not be forced to use by its existence. But without its existence those who want to use it, can’t.
I sort of agree, but it’s
Why are we making any decisions based on what Node does. It’s just one of many possible platforms that integrate with EMCAScript. There are many browser APIs that are not available on Node.
That’s true. And anyway who will be coding in JavaScript anymore. We’ll all be using some PL that compiles to JavaScript or WASM soon anyway.
Yw. Cheers. |
The don't repeat yourself (DRY) principle of software development says that:
Is remiss compared to:
if (console.assert(_ instanceof Promise)) reject()
The text was updated successfully, but these errors were encountered: