Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sapphire/result

sapphiredev28.9kMIT2.7.2TypeScript support: included

A TypeScript port of Nightly Rust's Result and Option structs

@sapphire/result, bot, discord, lexure, promise, sapphire, standalone, try catch, ts, typescript, wrapper, yarn

readme

Sapphire Logo

Sapphire Utilities

Common NodeJS packages for Sapphire Repositories and others.

GitHub

Packages

npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm npm

Buy us some doughnuts

Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!

We accept donations through Open Collective, Ko-fi, Paypal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.

Donate With Address
Open Collective Click Here
Ko-fi Click Here
Patreon Click Here
PayPal Click Here

Contributors

Please make sure to read the Contributing Guide before making a pull request.

Thank you to all the people who already contributed to Sapphire!

changelog

Changelog

All notable changes to this project will be documented in this file.

@sapphire/result@2.7.1 - (2024-11-02)

🐛 Bug Fixes

  • types: Resolve regression (a29026e) (#827 by @kyranet)

@sapphire/result@2.7.0 - (2024-11-02)

🐛 Bug Fixes

  • Move browser imports (100ffb0) (#826 by @kyranet)
  • Resolve build errors (809c41c) (#806 by @kyranet)
  • deps: Update all non-major dependencies (083376a) (#763 by @renovate[bot])
  • deps: Update all non-major dependencies (e7fdc5d) (#752 by @renovate[bot])

📝 Documentation

  • result: Update readme url for website (804cc21)

🚀 Features

🧪 Testing

  • result: Update test case (5932a43)

@sapphire/result@2.6.6 - (2024-01-19)

🐛 Bug Fixes

  • Fixed commonjs typings export mapping (#707) (216ff02)

@sapphire/result@2.6.5 - (2023-12-04)

🐛 Bug Fixes

  • result: Properly split CJS, ESM and IIFE (1f8f52e)
  • Update export mapping for proper ESM/CJS split (dd0cff8)
  • deps: Update all non-major dependencies (#607) (9cc8bd0)

📝 Documentation

  • readme: Add link to examples (e33b5b9)

🧪 Testing

  • Update vitest to coverage v8 (a4bc6e4)

@sapphire/result@2.6.4 - (2023-05-12)

🐛 Bug Fixes

  • result: Remove unnecessary tslib import (ec40daa)

@sapphire/result@2.6.3 - (2023-05-02)

🏠 Refactor

  • result: Internally rework code to ensure typings can be generated without conflicts (83d698e)

@sapphire/result@2.6.2 - (2023-04-17)

🐛 Bug Fixes

  • result: Add tslib dependency to fix __exportStar not being defined (4c51387)

@sapphire/result@2.6.1 - (2023-04-10)

🐛 Bug Fixes

  • result: Add missing type modifier (deb93b7)
  • deps: Update all non-major dependencies (#577) (291dd67)
  • deps: Update all non-major dependencies (#545) (40ca040)
  • deps: Update all non-major dependencies (#544) (cc78f17)
  • deps: Update all non-major dependencies (#532) (8033d1f)
  • deps: Update all non-major dependencies (#514) (21b07d5)

📝 Documentation

  • Add @06000208 as a contributor (fa3349e)
  • Add @didinele as a contributor (42ef7b6)
  • Add @goestav as a contributor (0e56a92)
  • Add @CitTheDev as a contributor (34169ea)
  • Add @legendhimslef as a contributor (059b6f1)

@sapphire/result@2.6.0 - (2022-10-16)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (#505) (6178296)

📝 Documentation

  • Add @r-priyam as a contributor (fb278ba)

🚀 Features

  • Add {Option,Result}.{any,all} (#501) (4c349bf)

@sapphire/result@2.5.0 - (2022-10-01)

🏠 Refactor

  • Split @sapphire/time-utilities into 4 sub-packages (#462) (574299a)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (#466) (dc08606)
  • deps: Update all non-major dependencies (e20f299)

📝 Documentation

  • Change name of @kyranet (#451) (df4fdef)
  • Update @RealShadowNova as a contributor (a869ba0)

🚀 Features

  • result: Add Result.unwrapRaw (#475) (82fe79e)

@sapphire/result@2.4.1 - (2022-08-29)

🧪 Testing

  • result: Add full coverage (#436) (3f06ac5)

@sapphire/result@2.4.0 - (2022-08-19)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (2308bd7)

🚀 Features

@sapphire/result@2.4.0 - (2022-08-19)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (2308bd7)

🚀 Features

@sapphire/result@2.3.3 - (2022-08-06)

🐛 Bug Fixes

  • result: Better unwrapOr*, added more tests (#416) (ec088a8)

@sapphire/result@2.3.2 - (2022-08-05)

🐛 Bug Fixes

  • Revert "make unwrap methods generic (#415) (v2.3.1)" (a963396)

@sapphire/result@2.3.1 - (2022-08-05)

🐛 Bug Fixes

  • result: Make unwrap methods generic (#415) (76e95b3)

@sapphire/result@2.3.0 - (2022-08-05)

🚀 Features

  • result: Add inspect*Async methods (#414) (fca7a80)

@sapphire/result@2.2.0 - (2022-08-04)

🐛 Bug Fixes

  • result: Resolve Unwrap type issues (#411) (3c2159c)

🚀 Features

  • result: Export ok, err, some, none, and improve docs (#412) (c978864)

@sapphire/result@2.1.1 - (2022-07-29)

🐛 Bug Fixes

  • Result: Type IResult.mapInto's return correctly (#405) (14ddf5f)

@sapphire/result@2.1.0 - (2022-07-29)

📝 Documentation

  • Add @muchnameless as a contributor (a1221fe)
  • Add @enxg as a contributor (d2382f0)
  • Add @EvolutionX-10 as a contributor (efc3a32)

🚀 Features

  • Result: Add new convenience methods (#404) (7c3ec61)

@sapphire/result@2.0.1 - (2022-07-03)

🏠 Refactor

  • result: Fixed types (#391) (a1934e1)

🐛 Bug Fixes

  • deps: Update all non-major dependencies (84af0db)

@sapphire/result@2.0.0 - (2022-06-26)

🏠 Refactor

  • Rewrite @sapphire/result from scratch (#364) (d5b57ff)

    💥 Breaking Changes:

    • Removed Maybe type, the substitute is Option
    • Removed maybe function, the substitute is Option.from
    • Removed some function, the substitute is Option.some
    • Removed none function, the substitute is Option.none
    • Removed isSome function, the substitute is option.isSome
    • Removed isNone function, the substitute is option.isNone
    • Removed isMaybe function, the substitute is Option.is
    • Removed UnwrapMaybeValue type, the substitute is Option.UnwrapSome
    • Removed None type, the substitute is Option.None
    • Removed Some type, the substitute is Option.Some
    • Removed Err type, the substitute is Result.Err
    • Removed Ok type, the substitute is Result.Ok
    • Removed from function, the substitute is Result.from
    • Removed fromAsync function, the substitute is Result.fromAsync

🐛 Bug Fixes

  • deps: Update all non-major dependencies (50cd8de)

📝 Documentation

  • Add @MajesticString as a contributor (295b3e9)
  • Add @Mzato0001 as a contributor (c790ef2)
  • Add @NotKaskus as a contributor (00da8f1)
  • Add @imranbarbhuiya as a contributor (fb674c2)
  • Add @axisiscool as a contributor (ce1aa31)
  • Add @dhruv-kaushikk as a contributor (ebbf43f)
  • Add @Commandtechno as a contributor (f1d69fa)
  • Fix typedoc causing OOM crashes (63ba41c)

🧪 Testing

  • Migrate to vitest (#380) (075ec73)

1.1.1 (2022-04-01)

Note: Version bump only for package @sapphire/result

1.1.0 (2022-03-06)

Features

1.0.0 (2022-02-06)

Features

  • package: add @sapphire/result package (#274) (8a86826)