Checks if the given value is a number in a normal range [0, 1].

Type signature

(x?: unknown) => boolean

Examples

normal(0.75);
// ⇒ true
Try in REPL
normal(-1);
// ⇒ false
Try in REPL
normal(2.5);
// ⇒ false
Try in REPL

Questions

  • How to check if a given value is in 0 to 1 inclusive range?

TypeScript sourceJavaScript source