concept number in category rxjs

appears as: number, numbers, numbers
RxJS in Action

This is an excerpt from Manning's book RxJS in Action.

Figure 1.10. A simple producer (an array of numbers) that emits events linearly. These events are submitted through the pipeline and transformed. The final data is then sent to all subscribers to be consumed.

Furthermore, you can extend this example to a sequence of numbers

Pure functions tend to be small in scope, have at most three clearly defined parameters (rarely more), and have a predictable, consistent output—like a black box with simple boundary conditions, as shown in figure 9.1. Moreover, a pure function is deterministic, which means its result is directly determined from the arguments that are passed to it, so half of the testing battle is just coming up with comprehensive sets of inputs. These can be any primitive type like a number or a string, or complex types such as objects and mocks (object impersonators), also shown in figure 9.1.

Reactive testing follows a similar format to how you normally test functional programs as described earlier. Because observables are pure functional data types, the transitive property of purity applies, which states that if an observable is made up solely of pure functions, the entire observable sequence is itself pure. Let’s begin with a cold observable that synchronously adds the numbers in an array.

Listing 9.5. Testing a stream that adds up all numbers of an array
describe('Adding numbers', function () {
  it('Should add numbers together', function () {

    const adder = (total, delta) => total + delta;

    Rx.Observable.from([1, 2, 3, 4, 5, 6, 7, 8, 9])
      .reduce(adder)
      .subscribe(total => {
          expect(total).to.equal(45);
      });
   });
});