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

Commit f25e211

Browse files
leandrozulianimattpodwysocki
authored andcommitted
fixing es6 code (#1282)
1 parent ae85b92 commit f25e211

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const source = getAsyncStockData();
4949
const subscription = source
5050
.filter(quote => quote.price > 30)
5151
.map(quote => quote.price)
52-
.forEach(price => console.log(`Prices higher than $30: ${price}`);
52+
.forEach(price => console.log(`Prices higher than $30: ${price}`));
5353
```
5454

5555
Now what if this data were to come as some sort of event, for example a stream, such as a WebSocket? Then we could pretty much write the same query to iterate our data, with very little change.
@@ -144,7 +144,7 @@ var distinct = debounced
144144
Now, let's query Wikipedia! In RxJS, we can instantly bind to any [Promises A+](https://github.com/promises-aplus/promises-spec) implementation through the `Rx.Observable.fromPromise` method. Or, directly return it and RxJS will wrap it for you.
145145

146146
```js
147-
function searchWikipedia (term) {
147+
let searchWikipedia = (term) => {
148148
return $.ajax({
149149
url: 'https://en.wikipedia.org/w/api.php',
150150
dataType: 'jsonp',
@@ -160,7 +160,7 @@ function searchWikipedia (term) {
160160
Once that is created, we can tie together the distinct throttled input and query the service. In this case, we'll call `flatMapLatest` to get the value and ensure we're not introducing any out of order sequence calls.
161161

162162
```js
163-
var suggestions = distinct
163+
const suggestions = distinct
164164
.flatMapLatest(searchWikipedia);
165165
```
166166

@@ -171,13 +171,13 @@ suggestions.subscribe(
171171
data => {
172172
$results
173173
.empty()
174-
.append($.map(data[1], value => $('<li>').text(value)))
174+
.append($.map(data[1], value => $('<li>').text(value)));
175175
},
176176
error => {
177177
$results
178178
.empty()
179179
.append($('<li>'))
180-
.text('Error:' + error);
180+
.text(`Error: ${error}`);
181181
});
182182
```
183183

0 commit comments

Comments
 (0)