diff --git a/README.md b/README.md index 4ee8c7a..be70021 100644 --- a/README.md +++ b/README.md @@ -5,30 +5,6 @@ and [Option](https://doc.rust-lang.org/std/option/) objects. Brings compile-time error checking and optional values to typescript. -## Relationship with ts-results - -This package is a friendly fork of the excellent https://github.com/vultix/ts-results/ -created due to time constraints on our (Lune's) side – we needed a package -available with some fixes. - -Notable changes compared to the original package: - -* Added ESM compatibility -* `Option` gained extra methods: `mapOr()`, `mapOrElse()`, `or()`, - `orElse()` -* `Result` also gained extra methods: `mapOr()`, `mapOrElse()`, - `expectErr()`, `or()`, `orElse()` -* `Ok` and `Err` no longer have the `val` property – it's `Ok.value` and `Err.error` now -* There is `Some.value` which replaced `Some.val` -* Boolean flags were replaced with methods: - * `Option.some` -> `Option.isSome()` - * `Option.none` -> `Option.isNone()` - * `Result.ok` -> `Result.isOk()` - * `Result.err` -> `Result.isErr()` - -We'll try to get the changes merged into the upstream package so that this fork -can become obsolete. - ## Contents - [Installation](#installation) diff --git a/docs/explanation/index.rst b/docs/explanation/index.rst new file mode 100644 index 0000000..c67b384 --- /dev/null +++ b/docs/explanation/index.rst @@ -0,0 +1,5 @@ +Explanation +=========== + +.. toctree:: + ts-results-relationship diff --git a/docs/explanation/ts-results-relationship.rst b/docs/explanation/ts-results-relationship.rst new file mode 100644 index 0000000..a159416 --- /dev/null +++ b/docs/explanation/ts-results-relationship.rst @@ -0,0 +1,25 @@ +Relationship with ts-results +============================ + +This package is a friendly fork of the excellent https://github.com/vultix/ts-results/ +created due to time constraints on our (Lune's) side – we needed a package +available with some fixes. + +Notable changes compared to the original package: + +* Added ESM compatibility +* ``Option`` gained extra methods: ``mapOr()``, ``mapOrElse()``, ``or()``, + ``orElse()`` +* ``Result`` also gained extra methods: ``mapOr()``, ``mapOrElse()``, + ``expectErr()``, ``or()``, ``orElse()`` +* ``Ok`` and ``Err`` no longer have the ``val`` property – it's ``Ok.value`` and ``Err.error`` now +* There is ``Some.value`` which replaced ``Some.val`` +* Boolean flags were replaced with methods: + + * ``Option.some`` -> ``Option.isSome()`` + * ``Option.none`` -> ``Option.isNone()`` + * ``Result.ok`` -> ``Result.isOk()`` + * ``Result.err`` -> ``Result.isErr()`` + +We'll try to get the changes merged into the upstream package so that this fork +can become obsolete. diff --git a/docs/index.rst b/docs/index.rst index 917189b..c47d770 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,6 +13,8 @@ The documentation will live here. :caption: User documentation: reference/index + explanation/index + .. toctree:: :maxdepth: 1