Skip to content

Convenience helpers and improved spec compliance

Latest

Choose a tag to compare

@OliverBrotchie OliverBrotchie released this 01 Nov 01:02
dd58d6e

This release brings some excellent feature suggestions from @aaronhuggins (#6) and brings this library's implementation closer to the Rust specification! This version will be released on NPM for greater availability of consumption.

Additions

Convenience helpers

  • from - Breaking Changes, diverges to from (synchronous) and fromAsync (asynchronous) methods to avoid the creation of unnecessary microtasks.
  • Symbol.toStringTag - Adds toString support which is useful in quickly and easily distinguishing resulting objects.
  • Symbol.hasInstance - Adds instanceof support to Ok, Err, Some and None.

Spec compliance

  • Iterator - Provides iterator deserialization by yielding the internal value if the internal value is not an Err or None.
  • Result.expectErr - An extra method to expect an Err result.
  • ok - A method to convert from Result<T, E> to Option<T>.
  • okOr - A method to convert from Option<T> to Result<T, E>.

May you have a blessed day! ❤️