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

Commit baf7fa9

Browse files
Merge pull request #881 from Widdershin/patch-1
Correct argument name and indentation in selectMany docs
2 parents adf137e + 2c85bfc commit baf7fa9

1 file changed

Lines changed: 50 additions & 43 deletions

File tree

doc/api/core/operators/selectmany.md

Lines changed: 50 additions & 43 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,24 +92,31 @@ var subscription = source.subscribe(
9292
// => Completed
9393

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

114121
//=> Outer: 2, Inner: 4, InnerIndex : 0, OuterIndex : 0
115122
//=> Outer: 2, Inner: 8, InnerIndex : 1, OuterIndex : 0

0 commit comments

Comments
 (0)