How to use the range function from rxjs

Find comprehensive JavaScript rxjs.range code examples handpicked from public code repositorys.

123
124
125
126
127
128
129
130
131
132
    }
}),
retryWhen(function (error$) {
    return zip(
        error$,
        range(1, retries + 1)
    ).pipe(
        mergeMap(
            ([error, retry]) => {
                if (error.statusCode < 500 || retry > retries)
fork icon45
star icon178
watch icon34

165
166
167
168
169
170
171
172
173
174
类似**Promise**
```
const { range } = require('rxjs');
const { map, filter } = require('rxjs/operators');
 
const pipe = range(1, 200).pipe(
  filter(x => x % 2 === 1),
  map(x => x + x),
  filter(x => x % 3 === 0),
  filter(x => x % 6 === 0),
fork icon197
star icon58
watch icon3

71
72
73
74
75
76
77
78
79
80
this.percentageHomeDelivery = (percentageHomeDelivery || 0) / 100 || 0.15 // based on guestimates from workshop with transport actors in oct 2021
this.percentageReturnDelivery = 0.1
this.kommun = kommun
this.cars = from(Object.entries(vehicles)).pipe(
  mergeMap(([type, count]) =>
    range(0, count).pipe(
      mergeMap(() => {
        const Vehicle = vehicleTypes[type].class

        return of(
fork icon1
star icon16
watch icon0

78
79
80
81
82
83
84
85
86
87
// const keys = Object.keys(essenceManager);
// const values = keys.map(key => `${key}: ${Reflect.get(essenceManager, key)}`);
// console.log(values);


// range(1, 200).pipe(
//     filter((x: any) => x % 2 === 1),
//     map((x: any) => x + x)
// ).subscribe((x: any) => {
//     console.log(x);
fork icon0
star icon3
watch icon3

+ 3 other calls in file

1
2
3
4
5
6
7
8
9
10
const { finalize, first, skip, map, concatMap, take, mergeMap, toArray, delay } = require('rxjs/operators')
const { pipe, merge, concat, interval, range, of, Observable, timer, from } = require('rxjs')


const sequential = (...commands) => {
  let base = range(0, commands.length)
  const command = {
    ...Command().action(
      (system, scheduler) => base.pipe(
        take(commands.length),
fork icon0
star icon1
watch icon7

+ 5 other calls in file

60
61
62
63
64
65
66
67
68
69
exports.of = rxjs.of;
exports.onErrorResumeNext = rxjs.onErrorResumeNext;
exports.pairs = rxjs.pairs;
exports.partition = rxjs.partition;
exports.race = rxjs.race;
exports.range = rxjs.range;
exports.throwError = rxjs.throwError;
exports.timer = rxjs.timer;
exports.using = rxjs.using;
exports.zip = rxjs.zip;
fork icon299
star icon0
watch icon1

277
278
279
280
281
282
283
284
285
286
if((!(client || {}).location || {}).lng){
  this.sendTextMessage(`El satelite no tiene la ubicación configurada, por favor comunicarse con soporte `, conversationContent.waId)
  return of({});
}
else if (availableServices >= 0 && availableServices <= 5) {
  return range(1, servicesToRequest).pipe(
    mergeMap(() => {
      const acEnabled = (specialServiceToRqstCountVal--) > 0;
      const airportTipEnabled = (airportCharCountVal--) > 0;
      return eventSourcing.eventStore.emitEvent$(this.buildServiceRequestedEsEvent(client, acEnabled, airportTipEnabled));
fork icon0
star icon0
watch icon5

+ 391 other calls in file

64
65
66
67
68
69
70
71
72
73
}

const today = new Date(new Date().toLocaleString('es-CO', { timeZone: 'America/Bogota' }));
const explorePastMonth = today.getDate() <= 1;

return range(explorePastMonth ? -1 : 0, explorePastMonth ? 2 : 1)
.pipe(
  map(monthsToAdd => mongoDB.getHistoricalDb(undefined, monthsToAdd)),
  map(db => db.collection(COLLECTION_NAME)),
  mergeMap(collection => {
fork icon0
star icon0
watch icon5

+ 82 other calls in file