From 4538afe4e8b5c0b0cb9217b70a172038f6d7ec4d Mon Sep 17 00:00:00 2001 From: Brian Zengel Date: Sun, 20 Oct 2013 16:36:10 -0400 Subject: [PATCH] added _.isFinite definition --- lodash/lodash-tests.ts | 5 +++++ lodash/lodash.d.ts | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3d3eef68d..fa3c3f246 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -617,6 +617,11 @@ result = _.isEqual(words, otherWords, function(a, b) { return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; }); +result = _.isFinite(-101); +result = _.isFinite('10'); +result = _.isFinite(true); +result = _.isFinite(''); +result = _.isFinite(Infinity); var mergeNames = { 'stooges': [ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e29003783..c05b43b36 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2416,6 +2416,16 @@ declare module _ { callback?: (a, b) => boolean, thisArg?: any): boolean; + /** + * Checks if value is, or can be coerced to, a finite number. + * + * Note: This is not the same as native isFinite which will return true for booleans and empty + * strings. See http://es5.github.io/#x15.1.2.5. + * @param value The value to check. + * @return True if the value is finite, else false. + **/ + export function isFinite(value: any): boolean; + /** * Recursively merges own enumerable properties of the source object(s), that don't resolve * to undefined into the destination object. Subsequent sources will overwrite property @@ -2664,15 +2674,6 @@ declare module _ { **/ export function isNumber(object: any): boolean; - /** - * Returns true if object is a finite Number. - * @param object Check if this object is a finite Number. - * @return True if `object` is a finite Number. - **/ - export function isFinite(object: any): boolean; - - - /** * Returns true if object is a RegExp. * @param object Check if this object is a RegExp.