Remove guard params.

This commit is contained in:
John-David Dalton
2017-03-05 02:37:18 -08:00
parent 89829331f0
commit bda6d56c60
14 changed files with 22 additions and 41 deletions

View File

@@ -8,7 +8,6 @@ import toInteger from './toInteger.js'
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as an iteratee for methods like `map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -24,12 +23,12 @@ import toInteger from './toInteger.js'
* dropRight([1, 2, 3], 0)
* // => [1, 2, 3]
*/
function dropRight(array, n, guard) {
function dropRight(array, n=1) {
const length = array == null ? 0 : array.length
if (!length) {
return []
}
n = (guard || n === undefined) ? 1 : toInteger(n)
n = toInteger(n)
n = length - n
return baseSlice(array, 0, n < 0 ? 0 : n)
}