Merge pull request #6391 from chrootsu/lodash-round

lodash: signatures of the method _.round changed
This commit is contained in:
Masahiro Wakame
2015-10-27 00:16:49 +09:00
2 changed files with 49 additions and 32 deletions
+20 -14
View File
@@ -2116,20 +2116,6 @@ result = <number>_(0.046).floor(2);
result = <number>_(4060).floor(-2);
// → 4000
// _.round
result = <number>_.round(4.006);
// → 4
result = <number>_.round(4.006, 2);
// → 4.01
result = <number>_.round(4060, -2);
// → 4100
result = <number>_(4.006).round();
// → 4
result = <number>_(4.006).round(2);
// → 4.01
result = <number>_(4060).round(-2);
// → 4100
result = <number>_.sum([4, 2, 8, 6]);
result = <number>_.sum([4, 2, 8, 6], function(v) { return v; });
result = <number>_.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<number>;
result = _(4.006).chain().round();
result = _(4.006).chain().round(2);
}
}
/**********
* Number *
**********/
+29 -18
View File
@@ -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<T> {
/**
* @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<T> {
/**
* @see _.round
*/
round(precision?: number): number;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.round
*/
round(precision?: number): LoDashExplicitWrapper<number>;
}
/**********
* Number *
**********/