Add _.subtract.

This commit is contained in:
DARCHY Jeremy
2015-11-06 16:53:54 +01:00
committed by John-David Dalton
parent 98e607e610
commit f6d81e1bd8
2 changed files with 77 additions and 6 deletions

View File

@@ -13100,9 +13100,9 @@
* @static
* @memberOf _
* @category Math
* @param {number} augend The first number to add.
* @param {number} addend The second number to add.
* @returns {number} Returns the sum.
* @param {number} augend The first number in an addition.
* @param {number} addend The second number in an addition.
* @returns {number} Returns the total.
* @example
*
* _.add(6, 4);
@@ -13293,6 +13293,31 @@
*/
var round = createRound('round');
/**
* Subtract two numbers.
*
* @static
* @memberOf _
* @category Math
* @param {number} minuend The first number in a subtraction.
* @param {number} subtrahend The second number in a subtraction.
* @returns {number} Returns the difference.
* @example
*
* _.subtract(6, 4);
* // => 2
*/
function subtract(minuend, subtrahend) {
var result;
if (minuend === minuend && minuend != null) {
result = minuend;
}
if (subtrahend === subtrahend && subtrahend != null) {
result = result === undefined ? subtrahend : (result - subtrahend);
}
return result;
}
/**
* Gets the sum of the values in `array`.
*
@@ -13631,6 +13656,7 @@
lodash.sortedLastIndexOf = sortedLastIndexOf;
lodash.startCase = startCase;
lodash.startsWith = startsWith;
lodash.subtract = subtract;
lodash.sum = sum;
lodash.sumBy = sumBy;
lodash.template = template;