Skip to content

Instantly share code, notes, and snippets.

@oxUnd
Created March 5, 2014 07:48
Show Gist options
  • Save oxUnd/9362892 to your computer and use it in GitHub Desktop.
Save oxUnd/9362892 to your computer and use it in GitHub Desktop.
code snippet
isNumeric: function( obj ) {
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment