mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Remove guard params.
This commit is contained in:
5
drop.js
5
drop.js
@@ -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'
|
||||
* drop([1, 2, 3], 0)
|
||||
* // => [1, 2, 3]
|
||||
*/
|
||||
function drop(array, n, guard) {
|
||||
function drop(array, n=1) {
|
||||
const length = array == null ? 0 : array.length
|
||||
if (!length) {
|
||||
return []
|
||||
}
|
||||
n = (guard || n === undefined) ? 1 : toInteger(n)
|
||||
n = toInteger(n)
|
||||
return baseSlice(array, n < 0 ? 0 : n, length)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user