Use more for-of

This commit is contained in:
John-David Dalton
2017-04-03 10:35:26 -07:00
parent f3957ac416
commit 3e2b0bb763
7 changed files with 18 additions and 33 deletions

View File

@@ -19,12 +19,11 @@ import isSymbol from './isSymbol.js'
*/
function maxBy(array, iteratee) {
let result
let index = -1
const length = array == null ? 0 : array.length
while (++index < length) {
if (array == null) {
return result
}
for (const value of array) {
let computed
const value = array[index]
const current = iteratee(value)
if (current != null && (computed === undefined