Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// check integer array
const num = parseFloat(value);
// num is 0 if you parseFloat for example a hex value - we don't
// want that
if (num === 0 || num % 1 !== 0) {
throw new TypeError(
`Array value invalid, Integer > 0 expected, got: ${value}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment