Skip to content

Commit

Permalink
feat: delete deprecated fns and methods (#7)
Browse files Browse the repository at this point in the history
* feat: delete deprecated resultify helpers

* feat: delete deprecated async methods of Result
  • Loading branch information
yifanwww committed Aug 20, 2024
1 parent c483c35 commit 7ab6bf0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1,238 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,9 @@ Calls the provided closure with a reference to the contained value if `Ok`.
Examples:

```ts
import { resultify } from 'rustlike-result';
import { resultifySync } from 'rustlike-result';

const num = resultify
.sync<SyntaxError>()(JSON.parse)('4')
const num = resultifySync<SyntaxError>()(JSON.parse)('4')
.inspect((value: number) => console.log(`original: ${value}`))
.map((value) => value ** 3)
.expect('failed to parse number');
Expand All @@ -471,10 +470,9 @@ Calls the provided closure with a reference to the contained value if `Err`.
Examples:

```ts
import { resultify } from 'rustlike-result';
import { resultifySync } from 'rustlike-result';

const num = resultify
.sync<SyntaxError>()(JSON.parse)('asdf')
const num = resultifySync<SyntaxError>()(JSON.parse)('asdf')
.inspectErr((err) => console.log(`failed to parse json string: ${err.message}`));
assert(num.err() instanceof SyntaxError);
```
Expand Down Expand Up @@ -660,12 +658,10 @@ This function can be used for control flow based on `Result` values.
Examples:

```ts
import { Err, Ok } from 'rustlike-result';
import { Err, Ok, resultifySync } from 'rustlike-result';

const parseJSON = (json: string) =>
resultify
.sync<SyntaxError>()(JSON.parse)(json)
.mapErr((err) => err.message);
resultifySync<SyntaxError>()(JSON.parse)(json).mapErr((err) => err.message);

assert(Ok<string, string>('2').andThen(parseJSON).equal(Ok(2)));
assert(
Expand Down
Loading

0 comments on commit 7ab6bf0

Please sign in to comment.