observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
970 stars 83 forks source link

Add integer to condition to getTypeValidator #347

Closed mkfreeman closed 1 year ago

mkfreeman commented 1 year ago

The getTypeValidator function doesn't have a case for integer. As a result, invalid results are formatted in the same way as valid integers. Perhaps:

const isValidInteger = (value) =>  Number.isInteger(value) && !Number.isNaN(value);
Screen Shot 2023-02-03 at 11 20 36 AM