mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 21:40:21 +00:00
Merge pull request #5032 from chrootsu/lodash-round
lodash: added _.round() method
This commit is contained in:
@@ -534,6 +534,20 @@ result = <_.LoDashWrapper<number>>_([4, 2, 8, 6]).min();
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).min(function (stooge) { return stooge.age; });
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).min('age');
|
||||
|
||||
// _.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});
|
||||
|
||||
Vendored
+18
@@ -3794,6 +3794,24 @@ declare module _ {
|
||||
whereValue: W): LoDashWrapper<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 LoDashWrapper<T> {
|
||||
/**
|
||||
* @see _.round
|
||||
*/
|
||||
round(precision?: number): number;
|
||||
}
|
||||
|
||||
//_.sum
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user