How to use the map function from rxjs
Find comprehensive JavaScript rxjs.map code examples handpicked from public code repositorys.
GitHub: openforis/sepal
17 18 19 20 21 22 23 24 25 26
'python3', 'get band names', [`${__dirname}/gdal/get_band_names.py`, path] ).pipe( filter(({stream}) => stream === 'stdout'), map(({value}) => JSON.parse(value)) ) }) const setBandNames$ = (path, bandNames) => defer(() =>
45
180
34
GitHub: openforis/sepal
112 113 114 115 116 117 118 119 120 121
request$.complete() log.debug(() => `${method} ${url} - ${status} (${ms}ms)`) } }) return request$.pipe( map(response => validateResponse(response, validStatuses)), catchError(e => { if (validStatuses && validStatuses.includes(e.statusCode)) { return of(e) } else {
45
178
34
GitHub: openforis/sepal
57 58 59 60 61 62 63 64 65 66
log.isTrace() && log.trace(`${usernameTag(user.username)} ${urlTag(req.url)} Updating user in user store`) firstValueFrom( get$(currentUserUrl, { headers: {[SEPAL_USER_HEADER]: JSON.stringify(user)} }).pipe( map((({body}) => JSON.parse(body))), switchMap(user => { log.isDebug() && log.debug(`${usernameTag(user.username)} ${urlTag(req.url)} Updated user in user store, connected to Google: ${!!user.googleTokens}`) return from(setUser(user)) }),
45
178
34
GitHub: openforis/sepal
58 59 60 61 62 63 64 65 66 67
const progressState$ = task.submit$(id, params).pipe( distinctUntilChanged((p1, p2) => _.isEqual( _.pick(p1, ['defaultMessage', 'messageKey', 'messageArgs']), _.pick(p2, ['defaultMessage', 'messageKey', 'messageArgs']) )), map(progress => { if (!progress.defaultMessage || !progress.messageKey) { log.warn(msg(id, `Malformed progress. Must contain 'defaultMessage' and 'messageKey' properties: ${JSON.stringify(progress)}`)) progress = { defaultMessage: 'Executing...',
45
178
34
GitHub: openforis/sepal
110 111 112 113 114 115 116 117 118 119
getInstance$: () => getInstance$().pipe( switchMap(instance => concat(of(instance), NEVER).pipe( tap(instance => lock(instance)), map(({item}) => item), finalize(() => release(instance)) ) ) )
45
178
34
+ 5 other calls in file
GitHub: openforis/sepal
81 82 83 84 85 86 87 88 89 90
} const cleanup$ = taskId => { log.debug(() => `EE task cleanup starting (${description}, ${taskId})`) return status$(taskId, 0).pipe( map(({state}) => isRunning(state)), switchMap(running => running ? cancel$(taskId, 3).pipe( map(() => true)
45
178
34
+ 7 other calls in file
17 18 19 20 21 22 23 24 25 26
retry(RETRIES) ) }) const download$ = ({bucketPath, prefix, downloadDir, deleteAfterDownload}) => cloudStorage$().pipe( map(cloudStorage => cloudStorage.bucket(`gs://${bucketPath}`)), switchMap(bucket => do$( `download: ${JSON.stringify({bucketPath, prefix, downloadDir, deleteAfterDownload})}`, bucket.getFiles({prefix, autoPaginate: true})
45
178
34
+ 5 other calls in file
GitHub: openforis/sepal
166 167 168 169 170 171 172 173 174 175
const selectedBands$ = selectedBands && selectedBands.length ? of(selectedBands) : imageFactory(model.reference, ccdcArgs).getBands$() const bands$ = selectedBands$.pipe( map(selectedBands => ({selectedBands, baseBands})) ) const ccdc$ = bands$.pipe( map(({selectedBands, baseBands}) => ({
45
177
0
+ 4 other calls in file
GitHub: openforis/sepal
17 18 19 20 21 22 23 24 25 26 27
const apps$ = () => fileToJson$('/var/lib/sepal/app-manager/apps.json').pipe( switchMap(({apps}) => from(apps)), filter(({repository}) => repository), map(({endpoint = 'shiny', label, repository, branch}) => { const name = basename(repository) return { endpoint, name,
45
177
0
GitHub: openforis/sepal
65 66 67 68 69 70 71 72 73 74
return getCollection$({ recipe: collectionRecipe, geometry, bands: [band] }).pipe( map(collection => collection.map(image => { var dayOfYear = image.date().getRelative('day', 'year').add(1) return image .addBands(ee.Image(dayOfYear).int16().rename('dayOfYear')) .set('dayOfYear', dayOfYear)
45
177
0
+ 2 other calls in file
GitHub: VEGMQAZ/sepal
20 21 22 23 24 25 26 27 28 29
const user = req.session.user log.debug(`[${user.username}] [${req.originalUrl}] Refreshing Google tokens for user`) return postJson$(refreshGoogleTokensUrl, { headers: {'sepal-user': JSON.stringify(user)} }).pipe( map(({body: googleTokens}) => { if (googleTokens) { log.debug(() => `[${user.username}] [${req.originalUrl}] Refreshed Google tokens`) req.session.user = {...user, googleTokens: JSON.parse(googleTokens)} res.set('sepal-user', JSON.stringify(req.session.user))
45
0
0
+ 3 other calls in file
GitHub: VEGMQAZ/sepal
133 134 135 136 137 138 139 140 141 142
) } const exists$ = ({path}) => from(access(path)).pipe( map(() => true), catchError(() => of(false)) ) const checkout$ = ({path, branch}) => {
45
0
0
+ 5 other calls in file
GitHub: VEGMQAZ/sepal
54 55 56 57 58 59 60 61 62 63
log.debug(() => message) return of(true).pipe( switchMap(() => driveLimiter$( auth$().pipe( map(auth => google.drive({version: 'v3', auth}) ), switchMap(drive => from(op(drive))
45
0
0
GitHub: lobotomisador/algorithms
11 12 13 14 15 16 17 18 19 20
if (e.status === 401) { // throw new Error(e.statusText) return of(1) .pipe( tap(() => console.info('inside of')), map(e => {status = 200; throw new Error('trigger a retry')}), ) } return of(e) }),
0
0
0
49 50 51 52 53 54 55 56 57 58
let cardSet = await rxjs.lastValueFrom( new http.HttpService() .get(downloadPath) .pipe( // rxjs.tap((response) => {console.log(`Request GET: ${downloadPath}`)}), rxjs.map((response) => response.data) ), ); if (appendOnly) { // caso seja só append, adiciona o resultado no objeto cardSet = [
0
0
0
GitHub: lobotomisador/algorithms
0 1 2 3 4 5 6 7 8 9
const { interval, timer, from, of, concatMap, map, concat, take, tap, switchMap, flatMap, mergeMap, reduce, EMPTY } = require('rxjs') // empty seems to be the Bacon.never() interval(1000) .pipe( mergeMap(e => e % 3 === 0 ? of(e) : EMPTY), map(e => e*2) ) .subscribe({ next: val => console.log('observer got val', val), error: err => console.error('observer errored', err),
0
0
0
+ 2 other calls in file
52 53 54 55 56 57 58 59 60 61
if (this.appintService._booking != undefined) { this.booking = this.appintService._booking; this.initializeFormData(this.booking); } this.filteredDoc = this.registrationForm.controls['doctor'].valueChanges.pipe(rxjs_1.startWith(''), rxjs_1.map(function (name) { return (name ? _this._filterDoc(name) : _this.doctors.slice()); })); this.filteredTown = this.registrationForm.controls['township'].valueChanges.pipe(rxjs_1.startWith(''), rxjs_1.map(function (name) { return (name ? _this._filterTown(name) : _this.towns.slice()); })); }; //initialize form with interface model RegistrationSetupComponent.prototype.initializeForm = function () { this.registrationForm = this.formBuilder.group({
0
0
2
+ 61 other calls in file
41 42 43 44 45 46 47 48 49 50
AppointmentRegistrationComponent.prototype.ngOnInit = function () { var _this = this; // this.getGender(); this.initializeForm(); this.filteredDoc = this.appointForm.controls['doctor'].valueChanges.pipe(rxjs_1.startWith(''), rxjs_1.map(function (name) { return (name ? _this._filterDoc(name) : _this.doctors.slice()); })); this.filteredPatient = this.appointForm.controls['patient'].valueChanges.pipe(rxjs_1.startWith(''), rxjs_1.map(function (name) { return (name ? _this._filterPatient(name) : _this.patient.slice()); })); }; AppointmentRegistrationComponent.prototype.initializeForm = function () { this.appointForm = this.fb.group({ regNo: [null],
0
0
2
+ 55 other calls in file