Skip to content

Commit 77f29c6

Browse files
committed
docs(either-errors): snippets and content
1 parent 73a5fa1 commit 77f29c6

File tree

5 files changed

+25
-62
lines changed

5 files changed

+25
-62
lines changed

articles/either-errors/README.md

+11-61
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,23 @@
11
<p align="center">
2-
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
2+
<a href="https://www.angular.love/" target="_blank"><img src="https://www.angular.love/wp-content/uploads/2020/07/logo-angular.png" alt="angular love"/></a>
33
</p>
44

5-
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6-
[circleci-url]: https://circleci.com/gh/nestjs/nest
5+
# Either & Error handling
76

8-
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9-
<p align="center">
10-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13-
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14-
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15-
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16-
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18-
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
19-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
20-
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
21-
</p>
22-
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23-
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
24-
25-
## Description
26-
27-
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
28-
29-
## Installation
30-
31-
```bash
32-
$ npm install
33-
```
34-
35-
## Running the app
36-
37-
```bash
38-
# development
39-
$ npm run start
40-
41-
# watch mode
42-
$ npm run start:dev
43-
44-
# production mode
45-
$ npm run start:prod
46-
```
47-
48-
## Test
49-
50-
```bash
51-
# unit tests
52-
$ npm run test
7+
## Notable libraries
538

54-
# e2e tests
55-
$ npm run test:e2e
9+
💖 `fp-ts` for streaming rows from postgres db
5610

57-
# test coverage
58-
$ npm run test:cov
59-
```
11+
💖 `@nestjs-architects/typed-cqrs` for a little more safety
6012

61-
## Support
13+
💖 `utility-types` for the sake of principle
6214

63-
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
15+
💖 ... and of course: `nestjs`
6416

65-
## Stay in touch
17+
## Running
6618

67-
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
68-
- Website - [https://nestjs.com](https://nestjs.com/)
69-
- Twitter - [@nestframework](https://twitter.com/nestframework)
19+
* run the application `npm run start`
7020

71-
## License
21+
## Tests
7222

73-
Nest is [MIT licensed](LICENSE).
23+
* `npm run test:e2e`
Loading
Loading
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Wyraź swoje metody!
2+
3+
Zachodzisz w głowę, czy i jakie błędy może zwrócić funkcja? Ułatw życie sobie i innym poprzez ekspresję intencji!
4+
5+
![Returning Either](01-either-declaration.png)
6+
7+
([Zobacz w praktyce!](link do repo))
8+
9+
# Skoro wyjątek może być wartością, to czym?
10+
11+
`enum`? `Symbol`? Przewagą `Symbol` jest możliwość uni typów.
12+
13+
![Symbol vs enum](02-symbol-enum.png)

articles/either-errors/src/book-rental/return-book.handler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export class ReturnBookHandler implements IInferredCommandHandler<ReturnBook> {
1212
if (isbn !== outOfStockIsbn && isbn !== limitReachedIsbn) {
1313
return left(TimeLimitExceeded);
1414
}
15-
return right(undefined);
15+
return right(null);
1616
}
1717
}

0 commit comments

Comments
 (0)