You could probably use LoDash http://lodash.com/docs#isFinite?