Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sequenceValidation doesn't work for Fail as stated in docs #250

Open
jtzero opened this issue Dec 6, 2021 · 1 comment
Open

sequenceValidation doesn't work for Fail as stated in docs #250

jtzero opened this issue Dec 6, 2021 · 1 comment

Comments

@jtzero
Copy link

jtzero commented Dec 6, 2021

the docs state that Failures will be accumulated in a list

monet.js/docs/LIST.md

Lines 316 to 332 in 5668595

```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

    "monet": "^0.9.3",
> node --version
v16.13.0
@ulfryk
Copy link
Member

ulfryk commented Nov 19, 2024

@jtzero please see #258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants