mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Bump to v3.10.0.
This commit is contained in:
25
math/ceil.js
Normal file
25
math/ceil.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import createRound from '../internal/createRound';
|
||||
|
||||
/**
|
||||
* Calculates `n` rounded up to `precision`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Math
|
||||
* @param {number} n The number to round up.
|
||||
* @param {number} [precision=0] The precision to round up to.
|
||||
* @returns {number} Returns the rounded up number.
|
||||
* @example
|
||||
*
|
||||
* _.ceil(4.006);
|
||||
* // => 5
|
||||
*
|
||||
* _.ceil(6.004, 2);
|
||||
* // => 6.01
|
||||
*
|
||||
* _.ceil(6040, -2);
|
||||
* // => 6100
|
||||
*/
|
||||
var ceil = createRound('ceil');
|
||||
|
||||
export default ceil;
|
||||
25
math/floor.js
Normal file
25
math/floor.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import createRound from '../internal/createRound';
|
||||
|
||||
/**
|
||||
* Calculates `n` rounded down to `precision`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Math
|
||||
* @param {number} n The number to round down.
|
||||
* @param {number} [precision=0] The precision to round down to.
|
||||
* @returns {number} Returns the rounded down number.
|
||||
* @example
|
||||
*
|
||||
* _.floor(4.006);
|
||||
* // => 4
|
||||
*
|
||||
* _.floor(0.046, 2);
|
||||
* // => 0.04
|
||||
*
|
||||
* _.floor(4060, -2);
|
||||
* // => 4000
|
||||
*/
|
||||
var floor = createRound('floor');
|
||||
|
||||
export default floor;
|
||||
25
math/round.js
Normal file
25
math/round.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import createRound from '../internal/createRound';
|
||||
|
||||
/**
|
||||
* Calculates `n` rounded to `precision`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Math
|
||||
* @param {number} n The number to round.
|
||||
* @param {number} [precision=0] The precision to round to.
|
||||
* @returns {number} Returns the rounded number.
|
||||
* @example
|
||||
*
|
||||
* _.round(4.006);
|
||||
* // => 4
|
||||
*
|
||||
* _.round(4.006, 2);
|
||||
* // => 4.01
|
||||
*
|
||||
* _.round(4060, -2);
|
||||
* // => 4100
|
||||
*/
|
||||
var round = createRound('round');
|
||||
|
||||
export default round;
|
||||
10
math/sum.js
10
math/sum.js
@@ -39,13 +39,11 @@ import toIterable from '../internal/toIterable';
|
||||
*/
|
||||
function sum(collection, iteratee, thisArg) {
|
||||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
||||
iteratee = null;
|
||||
iteratee = undefined;
|
||||
}
|
||||
var noIteratee = iteratee == null;
|
||||
|
||||
iteratee = noIteratee ? iteratee : baseCallback(iteratee, thisArg, 3);
|
||||
return noIteratee
|
||||
? arraySum(isArray(collection) ? collection : toIterable(collection))
|
||||
iteratee = baseCallback(iteratee, thisArg, 3);
|
||||
return iteratee.length == 1
|
||||
? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee)
|
||||
: baseSum(collection, iteratee);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user