Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 47a71e6

Browse files
committed
Use 2 space indentation in selectMany example
1 parent 7894776 commit 47a71e6

1 file changed

Lines changed: 47 additions & 42 deletions

File tree

doc/api/core/operators/selectmany.md

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ source.selectMany([1,2,3]);
4646
#### Example
4747
```js
4848
var source = Rx.Observable
49-
.range(1, 2)
50-
.selectMany(function (x) {
51-
return Rx.Observable.range(x, 2);
52-
});
49+
.range(1, 2)
50+
.selectMany(function (x) {
51+
return Rx.Observable.range(x, 2);
52+
});
5353

5454
var subscription = source.subscribe(
55-
function (x) {
56-
console.log('Next: ' + x);
57-
},
58-
function (err) {
59-
console.log('Error: ' + err);
60-
},
61-
function () {
62-
console.log('Completed');
63-
});
55+
function (x) {
56+
console.log('Next: ' + x);
57+
},
58+
function (err) {
59+
console.log('Error: ' + err);
60+
},
61+
function () {
62+
console.log('Completed');
63+
});
6464

6565
// => Next: 1
6666
// => Next: 2
@@ -70,20 +70,20 @@ var subscription = source.subscribe(
7070

7171
/* Using a promise */
7272
var source = Rx.Observable.of(1,2,3,4)
73-
.selectMany(function (x, i) {
74-
return Promise.resolve(x + i);
75-
});
73+
.selectMany(function (x, i) {
74+
return Promise.resolve(x + i);
75+
});
7676

7777
var subscription = source.subscribe(
78-
function (x) {
79-
console.log('Next: ' + x);
80-
},
81-
function (err) {
82-
console.log('Error: ' + err);
83-
},
84-
function () {
85-
console.log('Completed');
86-
});
78+
function (x) {
79+
console.log('Next: ' + x);
80+
},
81+
function (err) {
82+
console.log('Error: ' + err);
83+
},
84+
function () {
85+
console.log('Completed');
86+
});
8787

8888
// => Next: 1
8989
// => Next: 3
@@ -92,26 +92,31 @@ var subscription = source.subscribe(
9292
// => Completed
9393

9494
/* Using an array */
95-
Rx.Observable.of(2, 3, 5)
96-
.selectMany(function(x) {
97-
// Return x^2, x^3 and x^4
98-
return [
99-
x * x,
100-
x * x * x,
101-
x * x * x * x
102-
];
103-
},
104-
function(outer, inner, outerIndex, innerIndex) {
105-
return { outer : outer, inner : inner, outerIdx : outerIndex, innerIdx : innerIndex };
106-
}
107-
).subscribe(function(next) {
95+
Rx.Observable.of(2, 3, 5).selectMany(
96+
function(x) {
97+
// Return x^2, x^3 and x^4
98+
return [
99+
x * x,
100+
x * x * x,
101+
x * x * x * x
102+
];
103+
},
104+
105+
function(outer, inner, outerIndex, innerIndex) {
106+
return { outer : outer, inner : inner, outerIdx : outerIndex, innerIdx : innerIndex };
107+
}
108+
).subscribe(
109+
function(next) {
108110
console.log(
109-
'Outer: ' + next.outer + ', Inner: ' + next.inner, +
110-
', InnerIndex: ' + next.innerIdx + ', OuterIndex: ' + next.outerIdx
111+
'Outer: ' + next.outer + ', Inner: ' + next.inner, +
112+
', InnerIndex: ' + next.innerIdx + ', OuterIndex: ' + next.outerIdx
111113
);
112-
}, function() {
114+
},
115+
116+
function() {
113117
console.log('Completed');
114-
});
118+
}
119+
);
115120

116121
//=> Outer: 2, Inner: 4, InnerIndex : 0, OuterIndex : 0
117122
//=> Outer: 2, Inner: 8, InnerIndex : 1, OuterIndex : 0

0 commit comments

Comments
 (0)