Marak / colors.js

get colors in your node.js console
https://github.com/Marak/colors.js
Other
5.17k stars 445 forks source link

You don't need break in default statement #311

Open prietales opened 2 years ago

prietales commented 2 years ago

https://github.com/Marak/colors.js/blob/6bc50e79eeaa1d87369bb3e7e608ebed18c5cf26/lib/custom/zalgo.js#L92

G2G2G2G commented 2 years ago

lmao, shitty code.. what do you expect from npm

prietales commented 2 years ago

troll?

richRemer commented 2 years ago

You also don't need line breaks or most whitespace in code, but people do it for readability and style.

prietales commented 2 years ago

I'm sorry, but your argument doesn't fit in this case. Break is not necessary and it is not good practice, default is the last statement and you do not need to do any break as there will NEVER be a next statement, so more than helping, it creates confusion and hurts the eyes.

richRemer commented 2 years ago

That sounds like a well-thought out opinion. But it's still just an opinion. Can you provide sources or any evidence to backup your claims that it's not good practice?

prietales commented 2 years ago

You just have to read a few basic and advanced javascript books and see any example on the internet, you will never see the break in the default because it is not used that way. That it can be put on does not mean that it is the right thing to do. Putting a break in the default does not contribute anything, it is confusing and not understanding that a next statement is not really expected.

richRemer commented 2 years ago

It helps avoid issues during refactoring. Still waiting for actual citations to back up your personal opinion.

dhilt commented 2 years ago

Well, basically it is the case https://www.crockford.com/code.html

Each group of statements (except the default) should end with break, return, or throw.

Though it still can be treated as an opinion and I personally would not care at all... Anyway, instead of making multiple issues, I'd suggest @prietales create single Pull Request for such updates 😅

prietales commented 2 years ago

"Each group of statements (except the default) should end with break, return, or throw."

You're not always going to need every statement to end, Do you really think it's always necessary? Sometimes you want that a code apply to common conditions... It should, not it must.

You always need to put break before default statement, but not inside.

You never need break in default statement. The engine does not interpret it, it is useless code. NOT MY PERSONAL OPINION.

You cannot defend the indefensible and say that it is better to refactorize, speak without understanding in which cases it is good.

richRemer commented 2 years ago

"You always need to put break before default statement, but not inside."

Well, that's just flagrantly wrong. Maybe you should just close this before making yourself look dumber than you already have.

prietales commented 2 years ago

NO,

'default' is only reserved for the list of conditions that do not meet, in fact, good practices say that you should throw an exception in the default. If you put a return, you don't need break before default.

pro465 commented 2 years ago

@prietales you dont need to force others to do things the way you like them. you need to realize that people can have opinions and style different from yours.

prietales commented 2 years ago

It is not a question of opinions. There is a thing called good practices and it is a consensus reached by programmers after thousands of hours of work.

prietales commented 2 years ago

@pro465

theyre just Twitter trolls from the infinite loop incident. this isn't a real issue. they're being purposefully controversial for shits and giggles to spruce up their sad life. dont get sucked in

Please always use break in default statement. You are a PRO.

richRemer commented 2 years ago

@prietales if you put in a PR with unit tests, I'll make the changes to the code you've requested.

prietales commented 2 years ago

@prietales if you put in a PR with unit tests, I'll make the changes to the code you've requested.

This project is dead and you are nobody.

richRemer commented 2 years ago

@prietales is too junior to understand the difference between what he's comfortable with and best practices. @prietales should probably try a code academy or something so he/she/it can learn to understand the discussion.

prietales commented 2 years ago

Children adore their guru.

prietales commented 2 years ago

Break inside default and switch inside a for, for likes break statement.

pro465 commented 2 years ago

All juniors together now.

children adore their guru and shitty code.

yeah, while you act like a guru and force others to conform. the irony is real here.

prietales commented 2 years ago

I am not a guru nor do I want to be. I expose the reality that anyone who is not a junior can see a simple view. If you feel identified by something it will be.

pro465 commented 2 years ago

@prietales

I am not a guru nor do I want to be. I expose the reality that anyone who is not a junior can see a simple view. If you feel identified by something it will be.

and yet, when people say that others can have different opinions, you refer to them as gurus, while denying that you yourself are being a guru by forcing your opinions upon others and labeling them as so simple that "anyone who is not a junior" should be able to see them.

unless you can give data and evidence, they just remain your opinions, not bona-fide facts.

pro465 commented 2 years ago

i did not come here to argue and have my mind molded into an average person on twitter, so bye everybody, im gonna unsub from this thread.

@Ae3NerdGod have a nice day. @prietales forget whatever i said, and have a nice day. @Marak i dont know if the rumors about you are true, but i wish you a nice day, because, even if they are true, atleast I'm a human, and so I'm obliged to show everybody love ❤️ .

Potherca commented 2 years ago
  1. I call troll
  2. Show us any source to back up your opinion
  3. Put your money where your mouth is and open an MR

🙄