diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 627dda565..fbf7ea2ca 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -520,6 +520,20 @@ result = _(6.004).ceil(2); result = _(6040).ceil(-2); // → 6100 +// _.floor +result = _.floor(4.006); +// → 4 +result = _.floor(0.046, 2); +// → 0.04 +result = _.floor(4060, -2); +// → 4000 +result = _(4.006).floor(); +// → 4 +result = _(0.046).floor(2); +// → 0.04 +result = _(4060).floor(-2); +// → 4000 + result = _.max([4, 2, 8, 6]); result = _.max(stoogesAges, function (stooge) { return stooge.age; }); result = _.max(stoogesAges, 'age'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 7bc1df648..7923dae33 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3572,6 +3572,24 @@ declare module _ { ceil(precision?: number): number; } + //_.floor + interface LoDashStatic { + /** + * Calculates n rounded down to precision. + * @param n The number to round down. + * @param precision The precision to round down to. + * @return Returns the rounded down number. + */ + floor(n: number, precision?: number): number; + } + + interface LoDashWrapper { + /** + * @see _.floor + */ + floor(precision?: number): number; + } + //_.max interface LoDashStatic { /**