Skip to content

Instantly share code, notes, and snippets.

@eimfach
Created April 21, 2016 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eimfach/f0b4887df5e1da1339328d3d46dfaec2 to your computer and use it in GitHub Desktop.
Save eimfach/f0b4887df5e1da1339328d3d46dfaec2 to your computer and use it in GitHub Desktop.
// 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