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

chore: remove isString, isNumber #500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dimaMachina
Copy link
Contributor

@dimaMachina dimaMachina commented May 30, 2023

don't need dummy functions, native ts type narrowing works great

@dimaMachina dimaMachina requested a review from shuding as a code owner May 30, 2023 22:04
@vercel
Copy link

vercel bot commented May 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
satori-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2023 10:04pm

@LuciNyan
Copy link
Contributor

LuciNyan commented Jun 1, 2023

Are these changes really necessary? 🤔️ I still think that isNumber(xxx) is more concise and straightforward compared to typeof xxx === 'number'.

@dimaMachina
Copy link
Contributor Author

What’s the benefit isNumber and isString against typeof?

Downsides:

  1. Sometimes these functions are used in code bases but in most cases not
  2. Unneeded function call

@LuciNyan
Copy link
Contributor

LuciNyan commented Jun 1, 2023

What’s the benefit isNumber and isString against typeof?

Concise and straightforward.

2. Unneeded function call

It looks more concise, so I don't think this is unnecessary. Apart from your subjective view of it being unnecessary, are there any risks? 🤔️

@dimaMachina
Copy link
Contributor Author

They don’t look concise, they look like Monkey business code

They are just aliases for typeof

@LuciNyan
Copy link
Contributor

LuciNyan commented Jun 1, 2023

They don’t look concise, they look like Monkey business code

I beg to differ, but don’t mean to knock your coding tastes. It seems pointless to continue the discussion. You do you, as long as you’re content.

@Jackie1210
Copy link
Contributor

I think different people have different code tastes, i am saying here not for isNumber or typeof:

  1. bench
image

i run the bench in my machine, and it looks like there is little performance enhancement, or even worse?

  1. isNumber is more straightforward
  2. someone like me like reading commit to dig into this repo, non-sense commit just make commits' history noisy.
  3. no offense, but we should prompt more necessary change.

conclusion:

i think we should not make some pure code taste change, and should think is this pr really make this code better? and prove it. If just code taste change, maybe the code will change endlessly.😂

P.S: I perfer isNumber 🙈

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