From 4b999a376fc72577d9a3635911f7404b2343fb09 Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:46:48 +0200 Subject: [PATCH] lodash - Add _.toFinite --- types/lodash/index.d.ts | 42 ++++++++++++++++++++++++++++++++ types/lodash/lodash-tests.ts | 25 ++++++++++++++++++- types/lodash/toFinite/index.d.ts | 2 ++ types/lodash/tsconfig.json | 1 + 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 types/lodash/toFinite/index.d.ts diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..07988b3acd 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -12941,6 +12941,48 @@ declare namespace _ { toPlainObject(): LoDashImplicitObjectWrapper; } + //_.toFinite + interface LoDashStatic { + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + toFinite(value: any): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toFinite + */ + toFinite(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toFinite + */ + toFinite(): LoDashExplicitWrapper; + } + //_.toInteger interface LoDashStatic { /** diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..bfa3e0d17c 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -7657,13 +7657,36 @@ namespace TestToPlainObject { } } +// _.toFinite +namespace TestToFinite { + { + let result: number; + result = _.toFinite(true); + result = _.toFinite(1); + result = _.toFinite('3.2'); + result = _.toFinite([]); + result = _.toFinite({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toFinite(); + result = _(1).toFinite(); + result = _('3.2').toFinite(); + result = _([1]).toFinite(); + result = _([]).toFinite(); + result = _({}).toFinite(); + } +} + // _.toInteger namespace TestToInteger { { let result: number; result = _.toInteger(true); result = _.toInteger(1); - result = _.toInteger('a'); + result = _.toInteger('3.2'); result = _.toInteger([]); result = _.toInteger({}); } diff --git a/types/lodash/toFinite/index.d.ts b/types/lodash/toFinite/index.d.ts new file mode 100644 index 0000000000..f0317af649 --- /dev/null +++ b/types/lodash/toFinite/index.d.ts @@ -0,0 +1,2 @@ +import { toFinite } from "../index"; +export = toFinite; diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 419b6142b1..b740d6a4c2 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -247,6 +247,7 @@ "thru/index.d.ts", "times/index.d.ts", "toArray/index.d.ts", + "toFinite/index.d.ts", "toInteger/index.d.ts", "toLength/index.d.ts", "toLower/index.d.ts",