Bugfix: Do not unwrap / destructure array contents into combine list.
This release patches a bug where calling combine
on a Result<T, E>[]
or ResultAsync<T, E>[]
and the T
values were lists, then those lists would get concatenated into a single output list:
Example:
import { combine, ok } from 'neverthrow'
combine([
ok([ 1, 2, 3 ]),
ok([ 'hello', 'world ])
])
// before v4.1.1, the above would incorrectly return [ 1, 2, 3, 'hello', 'world' ]
//
// actual output should be [ [ 1,2,3 ], [ 'hello', 'world' ] ]
The fix of the bug can be found here:
I decided to continue using Array.prototype.concat
in spite of this subtlety because it does not mutate references (unlike Array.prototype.push
).