Remove isIterateeCall.

This commit is contained in:
John-David Dalton
2017-03-03 23:32:24 -08:00
parent ba52c744ae
commit 17f7069d07
11 changed files with 11 additions and 93 deletions

View File

@@ -1,4 +1,3 @@
import isIterateeCall from './.internal/isIterateeCall.js'
import copyArray from './.internal/copyArray.js'
import toInteger from './toInteger.js'
@@ -10,7 +9,6 @@ import toInteger from './toInteger.js'
* @category Array
* @param {Array} array The array to sample.
* @param {number} [n=1] The number of elements to sample.
* @param- {Object} [guard] Enables use as an iteratee for methods like `map`.
* @returns {Array} Returns the random elements.
* @example
*
@@ -20,12 +18,8 @@ import toInteger from './toInteger.js'
* sampleSize([1, 2, 3], 4)
* // => [2, 3, 1]
*/
function sampleSize(array, n, guard) {
if ((guard ? isIterateeCall(array, n, guard) : n === undefined)) {
n = 1
} else {
n = toInteger(n)
}
function sampleSize(array, n) {
n = toInteger(n)
const length = array == null ? 0 : array.length
if (!length || n < 1) {
return []