Skip to content

Conversation

@johannes-lindgren
Copy link
Contributor

@johannes-lindgren johannes-lindgren commented Nov 24, 2024

Hello, I'd like to add a new library to the benchmarks, PureParse:

PureParse
Strongly typed validation library that decouples type aliases from validation logic

Declare the type:

type User = {
  id: number
  name: string
}

const parseUser = object<User>({
  id: parseNumber,
  name: parseString,
})

...or infer the type:

const parseUser = object({
  id: parseNumber,
  name: parseString,
})

type User = Infer<typeof parseUser>

It does

  • parseSafe
  • parseStrict
  • assertLoose

For validation of objects, there are two alternate parsers/guards: non-compiled and just-in-time compiled. I was not sure how to differentiate between these two in the cases, so I appended the string (JIT compiled) to the case name.

I am the author of this library.

I tried my best to make all the necessary modifications (based on previous pull requests), but please do let me know if I need to do something differently.

The current version is 0.0.0-beta.7. I don't anticipate any major changes right now, but as long as it's in beta, I reserve the rights to make breaking changes. Is that okay?

@moltar
Copy link
Owner

moltar commented Nov 24, 2024

I reserve the rights to make breaking changes. Is that okay?

Of course. This project doesn't restrict you from changing anything as long as it adheres to the criterion outlined in the README.

@moltar moltar requested review from DarkGL and hoeck November 24, 2024 15:56
@johannes-lindgren
Copy link
Contributor Author

johannes-lindgren commented Nov 24, 2024

I reserve the rights to make breaking changes. Is that okay?

Of course. This project doesn't restrict you from changing anything as long as it adheres to the criterion outlined in the README.

I meant: if it is okay to include a library that is in "beta" in these benchmarks; but it seems so 🙂

I will follow up with another pull request when v1.0.0 is released.

@johannes-lindgren johannes-lindgren marked this pull request as ready for review November 24, 2024 16:26
@moltar
Copy link
Owner

moltar commented Nov 24, 2024

I meant: if it is okay to include a library that is in "beta" in these benchmarks; but it seems so 🙂

Oh ya, definitely can. If it can be installed using npm, then it's good to go 😁

@moltar moltar merged commit 6d7388a into moltar:master Nov 24, 2024
8 checks passed
@johannes-lindgren johannes-lindgren deleted the pure-parse branch November 25, 2024 15:19
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

Successfully merging this pull request may close these issues.

3 participants