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

Proposal: G.isFinite #108

Open
motherthestate opened this issue Mar 1, 2024 · 1 comment · May be fixed by #109
Open

Proposal: G.isFinite #108

motherthestate opened this issue Mar 1, 2024 · 1 comment · May be fixed by #109

Comments

@motherthestate
Copy link

motherthestate commented Mar 1, 2024

Since isNumber currently only checks if the value is a number or infinity.

function px (value: number | string) {
  if (G.isNumber(value)) return `${value}px`
  return px
}

px(1/0) // "Infinitypx"

// Proposal:
G.isFinite(1/0) // false

To be clear this does not actually add a new type guard since infinity is a number in javascript and typescript does not make the distinction.

@JUSTIVE JUSTIVE linked a pull request Mar 10, 2024 that will close this issue
@JUSTIVE
Copy link

JUSTIVE commented Mar 11, 2024

Hi. I made a PR to resolve this issue. please have a look and let me know if it's right.

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 a pull request may close this issue.

2 participants