diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 08feca346..642da557a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2116,20 +2116,6 @@ result = _(0.046).floor(2); result = _(4060).floor(-2); // → 4000 -// _.round -result = _.round(4.006); -// → 4 -result = _.round(4.006, 2); -// → 4.01 -result = _.round(4060, -2); -// → 4100 -result = _(4.006).round(); -// → 4 -result = _(4.006).round(2); -// → 4.01 -result = _(4060).round(-2); -// → 4100 - result = _.sum([4, 2, 8, 6]); result = _.sum([4, 2, 8, 6], function(v) { return v; }); result = _.sum({a: 2, b: 4}); @@ -3124,6 +3110,26 @@ module TestMin { result = _(dictionary).min<{a: number}, number>({a: 42}); } +// _.round +module TestRound { + { + let result: number; + + result = _.round(4.006); + result = _.round(4.006, 2); + + result = _(4.006).round(); + result = _(4.006).round(2); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(4.006).chain().round(); + result = _(4.006).chain().round(2); + } +} + /********** * Number * **********/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index afdcb028e..b7172fb3f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4556,24 +4556,6 @@ declare module _ { floor(precision?: number): number; } - //_.round - interface LoDashStatic { - /** - * Calculates n rounded to precision. - * @param n The number to round. - * @param precision The precision to round to. - * @return Returns the rounded number. - */ - round(n: number, precision?: number): number; - } - - interface LoDashImplicitWrapper { - /** - * @see _.round - */ - round(precision?: number): number; - } - //_.sum interface LoDashStatic { /** @@ -7631,6 +7613,35 @@ declare module _ { ): T; } + //_.round + interface LoDashStatic { + /** + * Calculates n rounded to precision. + * + * @param n The number to round. + * @param precision The precision to round to. + * @return Returns the rounded number. + */ + round( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): LoDashExplicitWrapper; + } + /********** * Number * **********/