checkGradefunction
Whether a value is a grade: "A", "B" or "C". Throws a RangeError that names the option when it is not, which is what minGrade does with a bad value.
Import it
import { checkGrade } from "@johnmorrisdotca/hoshi-stars/accuracy";
Definition
function checkGrade(value: unknown, name: string): StarGrade
Parameters
| Name | Type | Description |
|---|---|---|
value | unknown | Anything. |
name | string | The option's name, for the message. |
Returns
StarGrade
The grade, typed.
Examples
import { checkGrade } from "@johnmorrisdotca/hoshi-stars/accuracy";
console.log(checkGrade("B", "minGrade"));BWhat it prints (run when this page was built)