Skip to content

Commit ea5a3b2

Browse files
committed
chore: code formatting
1 parent fde9a6c commit ea5a3b2

File tree

6 files changed

+708
-12
lines changed

6 files changed

+708
-12
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
**/dist-server
44
**/tmp
55
**/out-tsc
6+
out/
67

78
NOTES.md
89

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ cd ngxs && npm i
1313
cd ngrx && npm i
1414
```
1515

16-
## Salad Bar
16+
How do I compare the code footprint between projects? Here's a simple formula:
1717

18+
`( {NgRx}.reducer.ts + {NgRx}.effects.ts ) ~= {NGXS}.state.ts`
19+
20+
Both projects have action classes defined in *.actions.ts files
21+
22+
Also, take a look at `salad-page.component.ts` to compare state *selectors* between libraries.
1823

1924
## Benchmarks
2025

@@ -25,7 +30,6 @@ cd ngxs && npm run analyzer
2530
cd ngrx && npm run analyzer
2631
```
2732

28-
###
2933

3034

3135

ngrx/src/app/shared/app.effects.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Action } from '@ngrx/store';
33
import { Actions, Effect, ofType } from '@ngrx/effects';
44
import { Observable } from 'rxjs/Observable';
55
import { of } from 'rxjs/observable/of';
6-
import { catchError, map, mergeMap, delay } from 'rxjs/operators';
6+
import { map, mergeMap } from 'rxjs/operators';
77
import { AppActionTypes, OrderFailed, OrderSuccess } from './app.actions';
88
import { OrderService } from '../order.service';
99

@@ -14,13 +14,7 @@ export class AppEffects {
1414
ofType(AppActionTypes.ConfirmOrder),
1515
mergeMap(action =>
1616
this.orderService.post().pipe(
17-
map(data => {
18-
if (data) {
19-
return new OrderSuccess();
20-
} else {
21-
return new OrderFailed();
22-
}
23-
})
17+
map(success => success ? new OrderSuccess() : new OrderFailed())
2418
)
2519
)
2620
);

ngxs/src/app/shared/app.state.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ export class AppState {
2828
confirm({ dispatch, patchState }: StateContext<AppStateModel>) {
2929
patchState({ status: 'pending' });
3030

31-
return this.orderService.post()
32-
.pipe(tap(success => (success ? dispatch(OrderSuccess) : dispatch(OrderFailed))));
31+
return this.orderService.post().pipe(
32+
tap(success => (success ? dispatch(OrderSuccess) : dispatch(OrderFailed)))
33+
);
3334
}
3435

3536
@Action(OrderSuccess)

0 commit comments

Comments
 (0)