Skip to content

Commit

Permalink
Move the ts-results fork documentation out of the readme (#150)
Browse files Browse the repository at this point in the history
Following up on the work started in [1].

Applied some necessary changes to the content since we're migrating
from Markdown to reStructuredText.

[1] 633ccad ("Set up an initial documentation structure (#81)")
  • Loading branch information
jstasiak authored Jul 5, 2024
1 parent c1c9d96 commit 98deca9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
24 changes: 0 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions docs/explanation/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Explanation
===========

.. toctree::
ts-results-relationship
25 changes: 25 additions & 0 deletions docs/explanation/ts-results-relationship.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The documentation will live here.
:caption: User documentation:

reference/index
explanation/index


.. toctree::
:maxdepth: 1
Expand Down

0 comments on commit 98deca9

Please sign in to comment.