the docs state that Failures will be accumulated in a list
|
```javascript |
|
List.fromArray([ |
|
Success("a"), |
|
Success("b"), |
|
Success("c") |
|
]).sequenceValidation() |
|
// => Success(List("a", "b", "c")) |
|
|
|
List.fromArray([ |
|
Success("a"), |
|
Success("b"), |
|
Fail("c"), |
|
Fail("d"), |
|
Success("e") |
|
]).sequenceValidation() |
|
// => Fail(List("c", "d")) |
|
``` |
const { Success, Fail, List } = require("monet");
> List.fromArray([
... Success("a"),
... Success("b"),
... Success("c")
... ]).sequenceValidation()
{
val: {
isNil: false,
head_: 'a',
tail_: {
isNil: false,
head_: 'b',
tail_: [Object],
size_: 2,
'@@type': 'monet.js/List'
},
size_: 3,
'@@type': 'monet.js/List'
},
isSuccessValue: true,
'@@type': 'monet.js/Validation'
}
> // => Success(List("a", "b", "c"))
undefined
>
> List.fromArray([
... Success("a"),
... Success("b"),
... Fail("c"),
... Fail("d"),
... Success("e")
... ]).sequenceValidation()
{ val: 'cd', isSuccessValue: false, '@@type': 'monet.js/Validation' }
And unless I;ve done this wrong, the type in the second example is returned as a string and not a list
> node --version
v16.13.0
the docs state that Failures will be accumulated in a list
monet.js/docs/LIST.md
Lines 316 to 332 in 5668595
And unless I;ve done this wrong, the type in the second example is returned as a string and not a list