diff --git a/.internal/baseSlice.js b/.internal/baseSlice.js index 5d114e436..c5a2141eb 100644 --- a/.internal/baseSlice.js +++ b/.internal/baseSlice.js @@ -1,5 +1,5 @@ /** - * The base implementation of `slice` without an iteratee call guard. + * The base implementation of `slice`. * * @private * @param {Array} array The array to slice. diff --git a/ary.js b/ary.js index a02f71c6d..367ee8789 100644 --- a/ary.js +++ b/ary.js @@ -11,15 +11,13 @@ const WRAP_ARY_FLAG = 128 * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {Function} Returns the new capped function. * @example * * map(['6', '8', '10'], ary(parseInt, 1)) * // => [6, 8, 10] */ -function ary(func, n, guard) { - n = guard ? undefined : n +function ary(func, n) { n = (func && n == null) ? func.length : n return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n) } diff --git a/curry.js b/curry.js index f3bad3131..fa46aac74 100644 --- a/curry.js +++ b/curry.js @@ -19,7 +19,6 @@ const WRAP_CURRY_FLAG = 8 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {Function} Returns the new curried function. * @example * @@ -42,8 +41,7 @@ const WRAP_CURRY_FLAG = 8 * curried(1)(_, 3)(2) * // => [1, 2, 3] */ -function curry(func, arity, guard) { - arity = guard ? undefined : arity +function curry(func, arity) { const result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity) result.placeholder = curry.placeholder return result diff --git a/curryRight.js b/curryRight.js index d75e10c35..c01246914 100644 --- a/curryRight.js +++ b/curryRight.js @@ -16,7 +16,6 @@ const WRAP_CURRY_RIGHT_FLAG = 16 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {Function} Returns the new curried function. * @example * @@ -39,8 +38,7 @@ const WRAP_CURRY_RIGHT_FLAG = 16 * curried(3)(1, _)(2) * // => [1, 2, 3] */ -function curryRight(func, arity, guard) { - arity = guard ? undefined : arity +function curryRight(func, arity) { const result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity) result.placeholder = curryRight.placeholder return result diff --git a/drop.js b/drop.js index 3063d1492..cf335cc66 100644 --- a/drop.js +++ b/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) } diff --git a/dropRight.js b/dropRight.js index 00d702a8a..b08bc88c9 100644 --- a/dropRight.js +++ b/dropRight.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' * 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) } diff --git a/orderBy.js b/orderBy.js index 3f1726bcc..f4acd902a 100644 --- a/orderBy.js +++ b/orderBy.js @@ -12,7 +12,6 @@ import baseOrderBy from './.internal/baseOrderBy.js' * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[identity]] * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `reduce`. * @returns {Array} Returns the new sorted array. * @see reverse * @example @@ -28,14 +27,13 @@ import baseOrderBy from './.internal/baseOrderBy.js' * orderBy(users, ['user', 'age'], ['asc', 'desc']) * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ -function orderBy(collection, iteratees, orders, guard) { +function orderBy(collection, iteratees, orders) { if (collection == null) { return [] } if (!Array.isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees] } - orders = guard ? undefined : orders if (!Array.isArray(orders)) { orders = orders == null ? [] : [orders] } diff --git a/parseInt.js b/parseInt.js index 51b301287..f8384785f 100644 --- a/parseInt.js +++ b/parseInt.js @@ -19,7 +19,6 @@ const nativeParseInt = root.parseInt * @category String * @param {string} string The string to convert. * @param {number} [radix=10] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {number} Returns the converted integer. * @example * @@ -29,8 +28,8 @@ const nativeParseInt = root.parseInt * map(['6', '08', '10'], parseInt) * // => [6, 8, 10] */ -function parseInt(string, radix, guard) { - if (guard || radix == null) { +function parseInt(string, radix) { + if (radix == null) { radix = 0 } else if (radix) { radix = +radix diff --git a/take.js b/take.js index a2247a1d8..8593f19de 100644 --- a/take.js +++ b/take.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 take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {Array} Returns the slice of `array`. * @example * @@ -24,11 +23,11 @@ import toInteger from './toInteger.js' * take([1, 2, 3], 0) * // => [] */ -function take(array, n, guard) { +function take(array, n=1) { if (!(array != null && array.length)) { return [] } - n = (guard || n === undefined) ? 1 : toInteger(n) + n = toInteger(n) return baseSlice(array, 0, n < 0 ? 0 : n) } diff --git a/takeRight.js b/takeRight.js index 2b0978f12..de512478b 100644 --- a/takeRight.js +++ b/takeRight.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 take. - * @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' * takeRight([1, 2, 3], 0) * // => [] */ -function takeRight(array, n, guard) { +function takeRight(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, n < 0 ? 0 : n, length) } diff --git a/trim.js b/trim.js index 5155303a4..101f21aae 100644 --- a/trim.js +++ b/trim.js @@ -12,7 +12,6 @@ import toString from './toString.js' * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {string} Returns the trimmed string. * @see trimEnd, trimStart * @example @@ -26,9 +25,9 @@ import toString from './toString.js' * map([' foo ', ' bar '], trim) * // => ['foo', 'bar'] */ -function trim(string, chars, guard) { +function trim(string, chars) { string = toString(string) - if (string && (guard || chars === undefined)) { + if (string && chars === undefined) { return string.trim() } if (!string || !(chars = baseToString(chars))) { diff --git a/trimEnd.js b/trimEnd.js index 6433160ee..f4a2a758b 100644 --- a/trimEnd.js +++ b/trimEnd.js @@ -13,7 +13,6 @@ const methodName = ''.trimRight ? 'trimRight': 'trimEnd' * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {string} Returns the trimmed string. * @see trim, trimStart * @example @@ -24,9 +23,9 @@ const methodName = ''.trimRight ? 'trimRight': 'trimEnd' * trimEnd('-_-abc-_-', '_-') * // => '-_-abc' */ -function trimEnd(string, chars, guard) { +function trimEnd(string, chars) { string = toString(string) - if (string && (guard || chars === undefined)) { + if (string && chars === undefined) { return string[methodName]() } if (!string || !(chars = baseToString(chars))) { diff --git a/trimStart.js b/trimStart.js index dc5c39bac..7ce23153c 100644 --- a/trimStart.js +++ b/trimStart.js @@ -13,7 +13,6 @@ const methodName = ''.trimLeft ? 'trimLeft' : 'trimStart' * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {string} Returns the trimmed string. * @see trim, trimEnd * @example @@ -24,9 +23,9 @@ const methodName = ''.trimLeft ? 'trimLeft' : 'trimStart' * trimStart('-_-abc-_-', '_-') * // => 'abc-_-' */ -function trimStart(string, chars, guard) { +function trimStart(string, chars) { string = toString(string) - if (string && (guard || chars === undefined)) { + if (string && chars === undefined) { return string[methodName]() } if (!string || !(chars = baseToString(chars))) { diff --git a/words.js b/words.js index e4d5ee51a..a182b48c6 100644 --- a/words.js +++ b/words.js @@ -10,7 +10,6 @@ import unicodeWords from './.internal/unicodeWords.js' * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. - * @param- {Object} [guard] Enables use as an iteratee for methods like `map`. * @returns {Array} Returns the words of `string`. * @example * @@ -20,10 +19,8 @@ import unicodeWords from './.internal/unicodeWords.js' * words('fred, barney, & pebbles', /[^, ]+/g) * // => ['fred', 'barney', '&', 'pebbles'] */ -function words(string, pattern, guard) { +function words(string, pattern) { string = toString(string) - pattern = guard ? undefined : pattern - if (pattern === undefined) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string) }