Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ofType rxjs operator #11

Closed
the-dr-lazy opened this issue Jan 28, 2019 · 1 comment
Closed

Add ofType rxjs operator #11

the-dr-lazy opened this issue Jan 28, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@the-dr-lazy
Copy link
Owner

In redux-observable there is an operator that is a higher order operator for the filter operator but it only can get an action type and doesn't work with action creators. In deox we should export an operator for this job that works correctly with both action type, action and action creator.

Possible Implementation

import { filter } from 'rxjs/operators'

const ofType = <TC extends ActionCreator | AnyAction | string>(typeContainer: TC) => {
  const targetType = typeof typeContainer === 'string' ? typeContainer : getType(typeContainer)

  return filter(({ type }) => type === targetType)
}
@the-dr-lazy the-dr-lazy added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jan 28, 2019
the-dr-lazy pushed a commit that referenced this issue Jan 29, 2019
the-dr-lazy pushed a commit that referenced this issue Feb 14, 2019
the-dr-lazy pushed a commit that referenced this issue Feb 14, 2019
# [1.1.0](v1.0.2...v1.1.0) (2019-02-14)

### Features

* add ofType operator ([63fb590](63fb590)), closes [#11](#11)
* deep immutable reducer type state ([de98e30](de98e30)), closes [#3](#3)
@irmantaszenkus
Copy link

Is adding rxjs as a dependency brings value to this project? Maybe it could come as a separate package like deox/ofType?

@the-dr-lazy the-dr-lazy removed good first issue Good for newcomers help wanted Extra attention is needed labels Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants