1 var baseSlice = require('../internal/baseSlice'),
2 isIterateeCall = require('../internal/isIterateeCall');
5 * Creates a slice of `array` with `n` elements dropped from the end.
10 * @param {Array} array The array to query.
11 * @param {number} [n=1] The number of elements to drop.
12 * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
13 * @returns {Array} Returns the slice of `array`.
16 * _.dropRight([1, 2, 3]);
19 * _.dropRight([1, 2, 3], 2);
22 * _.dropRight([1, 2, 3], 5);
25 * _.dropRight([1, 2, 3], 0);
28 function dropRight(array, n, guard) {
29 var length = array ? array.length : 0;
33 if (guard ? isIterateeCall(array, n, guard) : n == null) {
36 n = length - (+n || 0);
37 return baseSlice(array, 0, n < 0 ? 0 : n);
40 module.exports = dropRight;