How to use the rxjs/operators.map function in rxjs

To help you get started, we’ve selected a few rxjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexjlockwood / ShapeShifter / src / app / pages / editor / components / canvas / canvasoverlay.directive.ts View on Github external
ngAfterViewInit() {
    if (this.actionSource === ActionSource.Animated) {
      // Animated canvas specific setup.
      this.registerSubscription(
        combineLatest(
          // TODO: don't think this is necessary anymore? only need to query playback service now?
          merge(
            this.playbackService.asObservable().pipe(map(event => event.vl)),
            this.store.select(getVectorLayer),
          ),
          this.store.select(getCanvasOverlayState),
        ).subscribe(
          ([
            vectorLayer,
            { hiddenLayerIds, selectedLayerIds, isActionMode, selectedBlockLayerIds },
          ]) => {
            this.vectorLayer = vectorLayer;
            this.hiddenLayerIds = hiddenLayerIds;
            this.selectedLayerIds = selectedLayerIds;
            this.isActionMode = isActionMode;
            this.selectedBlockLayerIds = selectedBlockLayerIds;
            this.draw();
          },
        ),
github T-Systems-MMS / phonebook / Phonebook.Frontend / src / app / services / api / current-user.service.ts View on Github external
public getCurrentUserId(): Observable {
    return this.getCurrentUserObject().pipe(
      map(str => {
        // Userstring Layout is "Domain\\user"
        // This returns just the "user"
        return str.user.toLowerCase().split('\\')[1];
      })
    );
  }
github cloudfoundry / stratos / src / frontend / packages / core / src / shared / components / recent-entities / recent-entities.component.ts View on Github external
constructor(store: Store) {
    const recentEntities$ = store.select(recentlyVisitedSelector);
    this.hasHits$ = recentEntities$.pipe(
      map(recentEntities => recentEntities && !!recentEntities.hits && recentEntities.hits.length > 0)
    );
    const entitiesManager$ = recentEntities$.pipe(
      filter(recentEntities => recentEntities && !!recentEntities.hits && recentEntities.hits.length > 0),
      map(recentEntities => new CountedRecentEntitiesManager(recentEntities, store)),
    );
    this.frecentEntities$ = entitiesManager$.pipe(
      map(manager => manager.getFrecentEntities()),
    );
    this.recentEntities$ = entitiesManager$.pipe(
      map(manager => manager.getRecentEntities())
    );
  }
}
github SciCatProject / catanie / src / app / state-management / effects / published-data.effects.ts View on Github external
switchMap(({ doi }) =>
        this.publishedDataApi.register(encodeURIComponent(doi)).pipe(
          map(publishedData =>
            fromActions.registerPublishedDataCompleteAction({ publishedData })
          ),
          catchError(() => of(fromActions.registerPublishedDataFailedAction()))
        )
      )
github angular / angularfire / src / firestore / collection / changes.ts View on Github external
export function docChanges(query: Query): Observable[]> {
  return fromCollectionRef(query)
    .pipe(
      map(action =>
        action.payload.docChanges()
          .map(change => ({ type: change.type, payload: change } as DocumentChangeAction))));
}
github sourcegraph / sourcegraph / web / src / enterprise / labels / list / LabelDeleteButton.tsx View on Github external
const deleteLabel = (args: GQL.IDeleteLabelOnMutationArguments): Promise =>
    mutateGraphQL(
        gql`
            mutation DeleteLabel($label: ID!) {
                deleteLabel(label: $label) {
                    alwaysNil
                }
            }
        `,
        args
    )
        .pipe(
            map(dataOrThrowErrors),
            mapTo(void 0)
        )
        .toPromise()
github marblejs / marble / packages / @integration / src / effects / user.effects.ts View on Github external
mergeMap(req => of(req).pipe(
      map(req => req.params.id),
      switchMap(Dao.getUserById),
      map(user => ({ body: user })),
      catchError(() => throwError(
        new HttpError('User does not exist', HttpStatus.NOT_FOUND)
      ))
    )),
  )));
github sourcegraph / sourcegraph / web / src / site-admin / backend.tsx View on Github external
export function createUser(username: string, email: string | undefined): Observable {
    return mutateGraphQL(
        gql`
            mutation CreateUser($username: String!, $email: String) {
                createUser(username: $username, email: $email) {
                    resetPasswordURL
                }
            }
        `,
        { username, email }
    ).pipe(
        map(dataOrThrowErrors),
        map(data => data.createUser)
    )
}
github sourcegraph / sourcegraph / web / src / enterprise / threads / detail / fileDiffs / useThreadFileDiffs.ts View on Github external
...DiffStatFields
                                }
                            }
                        }
                    }
                }
            }
            ${gitRevisionRangeFieldsFragment}
            ${fileDiffFieldsFragment}
            ${fileDiffHunkRangeFieldsFragment}
            ${diffStatFieldsFragment}
        `,
        { changeset: changeset.id }
    ).pipe(
        map(dataOrThrowErrors),
        map(data => {
            if (!data || !data.node || data.node.__typename !== 'Changeset') {
                throw new Error('changeset not found')
            }
            return data.node.repositoryComparison
        })
    )
}
github tsmean / tsmean / frontend / src / app / resource / resource.service.ts View on Github external
getResources(resourceName: string): Observable {
    const $data = this.http
      .get(this.resourcesUrl(resourceName))
      .pipe(
        map((resp: any) => resp.data),
        share()
      );
    return $data.pipe(
      catchError(this.handleError)
    );
  }