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

feature: IsSafeInit validator #2183

Open
AcherTT opened this issue Aug 2, 2023 · 1 comment
Open

feature: IsSafeInit validator #2183

AcherTT opened this issue Aug 2, 2023 · 1 comment
Labels
flag: needs discussion Issues which needs discussion before implementation. type: feature Issues related to new features.

Comments

@AcherTT
Copy link

AcherTT commented Aug 2, 2023

Description

I need a secure JavaScript validator for validating "safe int" type.

example

 class MyClass {
    @IsSafeInt()
    someProperty: number;
  }

Proposed solution

use Number.isSafeInteger.

export function isSafeInt(val: unknown): val is Number {
  return typeof val === 'number' && Number.isSafeInteger(val);
}
@AcherTT AcherTT added flag: needs discussion Issues which needs discussion before implementation. type: feature Issues related to new features. labels Aug 2, 2023
@AcherTT AcherTT mentioned this issue Aug 2, 2023
6 tasks
@braaar
Copy link
Member

braaar commented Jan 11, 2024

I'm moving this to the discussion tab, as we are trying to keep the issue count low. Please see this issue for an explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: needs discussion Issues which needs discussion before implementation. type: feature Issues related to new features.
Development

No branches or pull requests

2 participants