Skip to content

Commit

Permalink
chore(docs): Add documentation about applySelector utility
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRyanDev committed Mar 27, 2016
1 parent 30f283e commit f70043f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,23 @@ return saga$ => saga$
.map(toPayload)
.do(payload => { ... });
```

#### applySelector<T,V>(selector: Observable<T> => Observable<V>)
Applies a selector function to the _state_ part of a saga iteration, returning
a new saga iteration composed of the action and the selected piece of state

__Params__
* `selector` __Observable<T> => Observable<V>__ Selector function to apply to the state

_Returns_ `Observable<SagaIteration<V>>`

```ts
function selectTodos() {
return (state$: Observable<{ todos: string[] }>) => state$
.map(s => s.todos)
.distinctUntilChanged();
}

return saga$ => saga$
.let(applySelector(selectTodos))
```

0 comments on commit f70043f

Please sign in to comment.