Skip to content

Commit 2a428a5

Browse files
author
Julian Dreissig
committed
Added test for map-with-reduce solution to explicitly verify handling of array entries.
1 parent aacb4c9 commit 2a428a5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

exercises/implement_map_with_reduce/exercise.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ var numbers = Array.apply(null, {length: Math.random() * 20 + 1}).map(function()
1010
return randomInt(0, 9)
1111
})
1212

13-
module.exports = runner(numbers, function(item) { return item * 3 })
13+
module.exports = runner.custom(function(map, numbers) {
14+
var result = []
15+
result.push('non-array entries', map(numbers, function(item) { return item * 3 }))
16+
result.push('array entries', map(numbers, function(item) { return [item * 3] }))
17+
return result
18+
})(numbers)

0 commit comments

Comments
 (0)