OliverBrotchie / optionals

Rust-like error handling and options for TypeScript and Deno!
MIT License
178 stars 8 forks source link

Feature requests: convenience helpers and improved spec compliance #6

Closed aaronhuggins closed 2 years ago

aaronhuggins commented 2 years ago

Some features that I'd like to contribute from my personal implementation that this one is missing. Opening issue for discussion before just opening a pull request to help eliminate unnecessary work. Some of these are convenience, some of these bring the implementations closer to the Rust spec. Porting these is little effort, as the code already exists in my own personal work.

Convenience helpers

Spec compliance

OliverBrotchie commented 2 years ago

Hey man, thanks for opening an issue I really appreciate the interest! Here are my thoughts:

Convenience helpers

Spec Compliance

aaronhuggins commented 2 years ago

Thanks for getting back to me! I appreciate the positive response and feedback, that's cool.

Convenience helpers

Spec Compliance

OliverBrotchie commented 2 years ago

@aaronhuggins I have opened a PR with all of the above changes except Symbol.hasInstance.

What did you have in mind for this? Converting Ok, Err and Some to symbols?

aaronhuggins commented 2 years ago

Oh! I was literally planning on opening the PR and contributing my existing code. :laughing:

I'll get you my code samples or get you another PR if you want.

OliverBrotchie commented 2 years ago

Oh sorry! 😆

Yeah if you could provide some snippets that would be great!

aaronhuggins commented 2 years ago

I'll add as comments in PR.