From 705eff4826660d11ec2af4fa7aafd4bed92e66a1 Mon Sep 17 00:00:00 2001 From: Raymond May Jr Date: Sun, 25 Mar 2012 10:43:30 -0500 Subject: [PATCH] add _.isFinite - verifies is a number between Inf && -Inf --- underscore.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/underscore.js b/underscore.js index aeaa8b1b0..98ffea186 100644 --- a/underscore.js +++ b/underscore.js @@ -812,6 +812,11 @@ return toString.call(obj) == '[object Number]'; }; + // Is a givin number finite? + _.isFinite = function(obj) { + return obj > -1/0 && obj < 1/0 && obj === -obj; + }; + // Is the given value `NaN`? _.isNaN = function(obj) { // `NaN` is the only value for which `===` is not reflexive.