Skip to content

Commit

Permalink
Merge pull request #30 from galenwarren/remove-firebase
Browse files Browse the repository at this point in the history
fix: fix addAttribute to ignore empty value
  • Loading branch information
galenwarren authored Sep 8, 2018
2 parents e8a14b7 + 219ddf0 commit b9c3a2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 124 deletions.
91 changes: 0 additions & 91 deletions src/firebase/realtime/__tests__/realtime.js

This file was deleted.

1 change: 0 additions & 1 deletion src/firebase/realtime/index.js

This file was deleted.

26 changes: 0 additions & 26 deletions src/firebase/realtime/realtime.js

This file was deleted.

17 changes: 11 additions & 6 deletions src/operators.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

export function afterUnsubscribe(action, delay) {
return source =>
Expand All @@ -16,11 +17,15 @@ export function afterUnsubscribe(action, delay) {
export function addAttribute(key, attributeValue) {
return source =>
Observable.create(subscriber => {
return source.subscribe(
value =>
subscriber.next(Object.assign({}, value, { [key]: attributeValue })),
error => subscriber.error(error),
() => subscriber.complete()
);
return source
.pipe(
map(
value =>
value
? Object.assign({}, value, { [key]: attributeValue })
: value
)
)
.subscribe(subscriber);
});
}

0 comments on commit b9c3a2f

Please sign in to comment.