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

Commit a741aa7

Browse files
Updating to v2.2.28
1 parent 800255c commit a741aa7

File tree

4 files changed

+176
-65
lines changed

4 files changed

+176
-65
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rxjs",
3-
"version": "2.2.27",
3+
"version": "2.2.28",
44
"main": [
55
"dist/rx.all.js",
66
"dist/rx.all.min.js",

doc/api/helpers/readme.md

Lines changed: 103 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,80 @@ Helper functions for the Reactive Extensions for JavaScript
44

55
## Documentation ##
66

7+
- [`Rx.helpers.defaultComparer`](#rxhelpersdefaultcomparerx-y)
8+
- [`Rx.helpers.defaultSubComparer`](#rxhelpersdefaultsubscomparerx-y)
79
- ['Rx.helpers.defaultError'](#rxhelpersdefaulterror)
810
- [`Rx.helpers.identity`](#rxhelpersidentityx)
911
- [`Rx.helpers.isPromise`](#rxhelpersispromisep)
1012
- [`Rx.helpers.just`](#rxhelpersjustvalue)
1113
- [`Rx.helpers.noop`](#rxhelpersnoop)
14+
- [`Rx.helpers.pluck`](#rxhelperspluckproperty)
1215

1316
* * *
1417

18+
### <a id="rxhelpersdefaultcomparerx-y"></a>`Rx.helpers.defaultComparer(x, y)`
19+
<a href="#rxhelpersdefaultcomparerx-y">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/basicheader.js "View in source") [&#x24C9;][1]
20+
21+
The default equality comparer, used when a comparer is not supplied to a function. Uses an internal deep equality check.
22+
23+
#### Arguments
24+
1. `x` *(Any)*: The first value to compare
25+
2. `y` *(Any)*: The second value to compare
26+
27+
#### Returns
28+
*(Boolean)*: `true` if equal; else `false`.
29+
30+
#### Example
31+
32+
```js
33+
var comparer = Rx.helpers.defaultComparer;
34+
35+
// Should return true
36+
var x = 42, y = 42
37+
console.log(comparer(x, y));
38+
// => true
39+
40+
// Should return false
41+
var x = new Date(0), y = new Date();
42+
console.log(comparer(x, y));
43+
// => false
44+
```
45+
* * *
46+
47+
### <a id="rxhelpersdefaultsubcomparerx-y"></a>`Rx.helpers.defaultSubcomparer(x, y)`
48+
<a href="#rxhelpersdefaultsubcomparerx-y">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/basicheader.js "View in source") [&#x24C9;][1]
49+
50+
The default comparer to determine whether one object is greater, less than or equal to another.
51+
52+
#### Arguments
53+
1. `x` *(Any)*: The first value to compare
54+
2. `y` *(Any)*: The second value to compare
55+
56+
#### Returns
57+
*(Number)*: Returns `1` if `x` is greater than `y`, `-1` if `y` is greater than `x`, and `0` if the objects are equal.
58+
59+
#### Example
60+
61+
```js
62+
var comparer = Rx.helpers.defaultSubcomparer;
63+
64+
// Should return 0
65+
var x = 42, y = 42
66+
console.log(comparer(x, y));
67+
// => 0
68+
69+
// Should return -1
70+
var x = new Date(0), y = new Date();
71+
console.log(comparer(x, y));
72+
// => -1
73+
74+
// Should return 1
75+
var x = 43, y = 42;
76+
console.log(comparer(x, y));
77+
// => 1
78+
```
79+
* * *
80+
1581
### <a id="rxhelpersdefaulterror"></a>`Rx.helpers.defaultError(err)`
1682
<a href="#rxhelpersdefaulterror">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/basicheader.js "View in source") [&#x24C9;][1]
1783

@@ -77,6 +143,29 @@ Rx.Observable.timer(100)
77143
```
78144
* * *
79145

146+
### <a id="rxhelpersispromisep"></a>`Rx.helpers.isPromise(p)`
147+
<a href="#rxhelpersispromisep">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/basicheader.js "View in source") [&#x24C9;][1]
148+
149+
A function which determines whether the object is a `Promise`.
150+
151+
#### Arguments
152+
1. `p` *(Any)*: The object to determine whether it is a promise.
153+
154+
#### Returns
155+
*(Boolean)*: `true` if the object is a `Promise` else `false`
156+
157+
#### Example
158+
159+
```js
160+
var isPromise = Rx.helpers.isPromise;
161+
162+
var p = RSVP.Promise(function (res) { res(42); });
163+
164+
console.log(isPromise(p));
165+
// => true
166+
```
167+
* * *
168+
80169
### <a id="rxhelpersnoop"></a>`Rx.helpers.noop()`
81170
<a href="#rxhelpersnoop">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/basicheader.js "View in source") [&#x24C9;][1]
82171

@@ -92,28 +181,30 @@ noop();
92181
```
93182
* * *
94183

95-
### <a id="rxhelpersispromisep"></a>`Rx.helpers.isPromise(p)`
96-
<a href="#rxhelpersispromisep">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/basicheader.js "View in source") [&#x24C9;][1]
184+
### <a id="rxhelperspluckproperty"></a>`Rx.helpers.pluck(property)`
185+
<a href="#rxhelperspluckproperty">#</a>[&#x24C8;](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/basicheader.js "View in source") [&#x24C9;][1]
97186

98-
A function which determines whether the object is a `Promise`.
187+
Plucks a property from the object.
99188

100189
#### Arguments
101-
1. `p` *(Any)*: The object to determine whether it is a promise.
190+
1. `property` *(String)*: The property name to pluck from the object.
102191

103192
#### Returns
104-
*(Boolean)*: `true` if the object is a `Promise` else `false`
193+
*(Boolean)*: `true` if equal; else `false`.
105194

106195
#### Example
107196

108197
```js
109-
var isPromise = Rx.helpers.isPromise;
198+
var pluck = Rx.helpers.pluck;
110199

111-
var p = RSVP.Promise(function (res) { res(42); });
200+
var source = Rx.Observable.interval(1000)
201+
.timeInterval()
202+
.map(pluck('value'))
203+
.take(3);
112204

113-
var isPromise(p);
114-
console.log(p);
115-
// => true
205+
source.subscribe(console.log.bind(console));
206+
// => 0
207+
// => 1
208+
// => 2
116209
```
117210
* * *
118-
119-

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "rx",
33
"title": "Reactive Extensions for JavaScript (RxJS)",
44
"description": "Library for composing asynchronous and event-based operations in JavaScript",
5-
"version": "2.2.27",
5+
"version": "2.2.28",
66
"homepage": "https://github.com/Reactive-Extensions/RxJS",
77
"author": {
88
"name": "Cloud Programmability Team",
@@ -20,7 +20,7 @@
2020
],
2121
"bugs": "https://github.com/Reactive-Extensions/RxJS/issues",
2222
"jam": {
23-
"main": "rx.js"
23+
"main": "dist/rx.all.js"
2424
},
2525
"dependencies": {},
2626
"devDependencies": {

readme.md

Lines changed: 70 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ But the best news of all is that you already know how to program like this. Tak
4545
var source = getStockData();
4646

4747
source
48-
.filter(function (quote) {
49-
return quote.price > 30;
50-
})
51-
.map(function (quote) {
52-
return quote.price;
53-
})
54-
.forEach(function (price) {
55-
console.log('Prices higher than $30: $' + price);
56-
});
48+
.filter(function (quote) {
49+
return quote.price > 30;
50+
})
51+
.map(function (quote) {
52+
return quote.price;
53+
})
54+
.forEach(function (price) {
55+
console.log('Prices higher than $30: $' + price);
56+
});
5757
```
5858

5959
Now what if this data were to come as some sort of event, for example a stream, such as as a WebSocket, then we could pretty much write the same query to iterate our data, with very little change.
@@ -63,19 +63,19 @@ Now what if this data were to come as some sort of event, for example a stream,
6363
var source = getAsyncStockData();
6464

6565
var subscription = source
66-
.filter(function (quote) {
67-
return quote.price > 30;
68-
})
69-
.map(function (quote) {
70-
return quote.price;
71-
})
72-
.subscribe(
73-
function (price) {
74-
console.log('Prices higher than $30: $' + price);
75-
},
76-
function (err) {
77-
console.log('Something went wrong: ' + err.message);
78-
});
66+
.filter(function (quote) {
67+
return quote.price > 30;
68+
})
69+
.map(function (quote) {
70+
return quote.price;
71+
})
72+
.subscribe(
73+
function (price) {
74+
console.log('Prices higher than $30: $' + price);
75+
},
76+
function (err) {
77+
console.log('Something went wrong: ' + err.message);
78+
});
7979

8080
/* When we're done */
8181
subscription.dispose();
@@ -111,10 +111,10 @@ One question you may ask yourself, is why RxJS? What about Promises? Promises
111111
To give you an idea about rich composition, we can create an autocompletion service which takes the user input from a text input and then query a service, making sure not to flood the service with calls for every key stroke, but instead allow to go at a more natural pace.
112112

113113
First, we'll reference the JavaScript files, including jQuery, although RxJS has no dependencies on jQuery...
114-
115-
<script src="http://code.jquery.com/jquery.js"></script>
116-
<script src="rx.lite.js"></script>
117-
114+
```html
115+
<script src="http://code.jquery.com/jquery.js"></script>
116+
<script src="rx.lite.js"></script>
117+
```
118118
Next, we'll get the user input from an input, listening to the keyup event by using the `Rx.Observable.fromEvent` method. This will either use the event binding from [jQuery](http://jquery.com), [Zepto](http://zeptojs.com/), [AngularJS](https://angularjs.org/) and [Ember.js](http://emberjs.com/) if available, and if not, falls back to the native event binding. This gives you consistent ways of thinking of events depending on your framework, so there are no surprises.
119119

120120
```js
@@ -214,6 +214,13 @@ You can find the documentation [here](https://github.com/Reactive-Extensions/RxJ
214214
- [RxJS Koans](https://github.com/mattpodwysocki/RxJSKoans)
215215
- [Rx Workshop](http://rxworkshop.codeplex.com/)
216216
- [The introduction to Reactive Programming you've been missing](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754)
217+
- [Reactive Programming and MVC](http://aaronstacy.com/writings/reactive-programming-and-mvc/)
218+
219+
- Examples
220+
- [React RxJS Autocomplete](https://github.com/eliseumds/react-autocomplete)
221+
- [React RxJS TODO MVC](https://github.com/fdecampredon/react-rxjs-todomvc)
222+
- [Ninya.io - Angular + RxJS + rx.angular.js](https://github.com/ninya-io/ninya.io) - [Site](http://stackwho.herokuapp.com/)
223+
- [Reactive Trader](https://github.com/AdaptiveConsulting/ReactiveTrader) - [Site](https://reactivetrader.azurewebsites.net/)
217224

218225
- Presentations
219226
- Don't Cross the Streams - Cascadia.js 2012 [slides/demos](http://www.slideshare.net/mattpodwysocki/cascadiajs-dont-cross-the-streams) | [video](http://www.youtube.com/watch?v=FqBq4uoiG0M)
@@ -230,11 +237,13 @@ You can find the documentation [here](https://github.com/Reactive-Extensions/RxJ
230237
- [Adding Even More Fun to Functional Programming With RXJS - Ryan Anklam](https://www.youtube.com/watch?v=8EExNfm0gt4)
231238

232239
- Reference Material
240+
- [RxJS GitBook](http://xgrommx.github.io/rx-book/)
233241
- [Intro to Rx](http://introtorx.com/)
234242
- [101 Rx Samples Wiki](http://rxwiki.wikidot.com/101samples)
235243
- [Rx Design Guidelines](http://go.microsoft.com/fwlink/?LinkID=205219)
236244
- [Beginners Guide to Rx](http://msdn.microsoft.com/en-us/data/gg577611)
237245

246+
238247
- Books
239248
- [Intro to Rx](http://www.amazon.com/Introduction-to-Rx-ebook/dp/B008GM3YPM/)
240249
- [Programming Reactive Extensions and LINQ](http://www.amazon.com/Programming-Reactive-Extensions-Jesse-Liberty/dp/1430237473/)
@@ -245,22 +254,29 @@ There are a number of ways to get started with RxJS. The files are available on
245254

246255
### Download the Source
247256

248-
git clone https://github.com/Reactive-Extensions/rxjs.git
249-
cd ./rxjs
257+
```bash
258+
git clone https://github.com/Reactive-Extensions/rxjs.git
259+
cd ./rxjs
260+
```
250261

251262
### Installing with [NPM](https://npmjs.org/)
252263

253-
npm install rx
254-
npm install -g rx
255-
WARNING: 'npm install rxjs' will install an old, out of date, 3rd party version of Rx.
264+
```bash`
265+
npm install rx
266+
npm install -g rx
267+
```
256268
257269
### Using with Node.js and Ringo.js
258270
259-
var Rx = require('rx');
271+
```js
272+
var Rx = require('rx');
273+
```
260274

261275
### Installing with [Bower](http://bower.io/)
262276

263-
bower install rxjs
277+
```bash
278+
bower install rxjs
279+
```
264280

265281
### Installing with [Jam](http://jamjs.org/)
266282

@@ -287,27 +303,31 @@ There are a number of ways to get started with RxJS. The files are available on
287303

288304
### In a Browser:
289305

290-
<!-- Just the core RxJS -->
291-
<script src="rx.js"></script>
306+
```html
307+
<!-- Just the core RxJS -->
308+
<script src="rx.js"></script>
292309

293-
<!-- Or all of RxJS minus testing -->
294-
<script src="rx.complete.js"></script>
310+
<!-- Or all of RxJS minus testing -->
311+
<script src="rx.complete.js"></script>
295312

296-
<!-- Or keeping it lite -->
297-
<script src="rx.lite.js"></script>
313+
<!-- Or keeping it lite -->
314+
<script src="rx.lite.js"></script>
315+
```
298316

299317
### Along with a number of our extras for RxJS:
300318

301-
<script src="rx.aggregates.js"></script>
302-
<script src="rx.async.js"></script>
303-
<script src="rx.backpressure.js"></script>
304-
<script src="rx.binding.js"></script>
305-
<script src="rx.coincidencejs"></script>
306-
<script src="rx.experimental.js"></script>
307-
<script src="rx.joinpatterns.js"></script>
308-
<script src="rx.time.js"></script>
309-
<script src="rx.virtualtime.js"></script>
310-
<script src="rx.testing.js"></script>
319+
```html
320+
<script src="rx.aggregates.js"></script>
321+
<script src="rx.async.js"></script>
322+
<script src="rx.backpressure.js"></script>
323+
<script src="rx.binding.js"></script>
324+
<script src="rx.coincidencejs"></script>
325+
<script src="rx.experimental.js"></script>
326+
<script src="rx.joinpatterns.js"></script>
327+
<script src="rx.time.js"></script>
328+
<script src="rx.virtualtime.js"></script>
329+
<script src="rx.testing.js"></script>
330+
```
311331

312332
### Using RxJS with an AMD loader such as Require.js
313333

@@ -350,7 +370,7 @@ You can contribute by reviewing and sending feedback on code checkins, suggestin
350370

351371
Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
352372
Microsoft Open Technologies would like to thank its contributors, a list
353-
of whom are at http://rx.codeplex.com/wikipage?title=Contributors.
373+
of whom are at https://github.com/Reactive-Extensions/RxJS/wiki/Contributors.
354374

355375
Licensed under the Apache License, Version 2.0 (the "License"); you
356376
may not use this file except in compliance with the License. You may

0 commit comments

Comments
 (0)