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

Commit 4b0fd51

Browse files
Fixing map/filter
1 parent 0ff6942 commit 4b0fd51

26 files changed

Lines changed: 656 additions & 657 deletions

dist/rx.all.compat.js

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5041,47 +5041,47 @@
50415041
return new MapObservable(this.source, innerMap(selector, this), thisArg);
50425042
};
50435043

5044-
MapObservable.prototype.subscribeCore = function (observer) {
5045-
return this.source.subscribe(new MapObserver(observer, this.selector, this));
5044+
MapObservable.prototype.subscribeCore = function (o) {
5045+
return this.source.subscribe(new InnerObserver(o, this.selector, this));
5046+
};
5047+
5048+
function InnerObserver(o, selector, source) {
5049+
this.o = o;
5050+
this.selector = selector;
5051+
this.source = source;
5052+
this.i = 0;
5053+
this.isStopped = false;
5054+
}
5055+
5056+
InnerObserver.prototype.onNext = function(x) {
5057+
if (this.isStopped) { return; }
5058+
var result = tryCatch(this.selector)(x, this.i++, this.source);
5059+
if (result === errorObj) {
5060+
return this.o.onError(result.e);
5061+
}
5062+
this.o.onNext(result);
5063+
};
5064+
InnerObserver.prototype.onError = function (e) {
5065+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
5066+
};
5067+
InnerObserver.prototype.onCompleted = function () {
5068+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
5069+
};
5070+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
5071+
InnerObserver.prototype.fail = function (e) {
5072+
if (!this.isStopped) {
5073+
this.isStopped = true;
5074+
this.o.onError(e);
5075+
return true;
5076+
}
5077+
5078+
return false;
50465079
};
50475080

50485081
return MapObservable;
50495082

50505083
}(ObservableBase));
50515084

5052-
function MapObserver(observer, selector, source) {
5053-
this.observer = observer;
5054-
this.selector = selector;
5055-
this.source = source;
5056-
this.i = 0;
5057-
this.isStopped = false;
5058-
}
5059-
5060-
MapObserver.prototype.onNext = function(x) {
5061-
if (this.isStopped) { return; }
5062-
var result = tryCatch(this.selector)(x, this.i++, this.source);
5063-
if (result === errorObj) {
5064-
return this.observer.onError(result.e);
5065-
}
5066-
this.observer.onNext(result);
5067-
};
5068-
MapObserver.prototype.onError = function (e) {
5069-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
5070-
};
5071-
MapObserver.prototype.onCompleted = function () {
5072-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
5073-
};
5074-
MapObserver.prototype.dispose = function() { this.isStopped = true; };
5075-
MapObserver.prototype.fail = function (e) {
5076-
if (!this.isStopped) {
5077-
this.isStopped = true;
5078-
this.observer.onError(e);
5079-
return true;
5080-
}
5081-
5082-
return false;
5083-
};
5084-
50855085
/**
50865086
* Projects each element of an observable sequence into a new form by incorporating the element's index.
50875087
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
@@ -5416,8 +5416,8 @@
54165416
__super__.call(this);
54175417
}
54185418

5419-
FilterObservable.prototype.subscribeCore = function (observer) {
5420-
return this.source.subscribe(new FilterObserver(observer, this.predicate, this));
5419+
FilterObservable.prototype.subscribeCore = function (o) {
5420+
return this.source.subscribe(new InnerObserver(o, this.predicate, this));
54215421
};
54225422

54235423
function innerPredicate(predicate, self) {
@@ -5427,43 +5427,43 @@
54275427
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
54285428
return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);
54295429
};
5430+
5431+
function InnerObserver(o, predicate, source) {
5432+
this.o = o;
5433+
this.predicate = predicate;
5434+
this.source = source;
5435+
this.i = 0;
5436+
this.isStopped = false;
5437+
}
5438+
5439+
InnerObserver.prototype.onNext = function(x) {
5440+
if (this.isStopped) { return; }
5441+
var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);
5442+
if (shouldYield === errorObj) {
5443+
return this.o.onError(shouldYield.e);
5444+
}
5445+
shouldYield && this.o.onNext(x);
5446+
};
5447+
InnerObserver.prototype.onError = function (e) {
5448+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
5449+
};
5450+
InnerObserver.prototype.onCompleted = function () {
5451+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
5452+
};
5453+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
5454+
InnerObserver.prototype.fail = function (e) {
5455+
if (!this.isStopped) {
5456+
this.isStopped = true;
5457+
this.o.onError(e);
5458+
return true;
5459+
}
5460+
return false;
5461+
};
54305462

54315463
return FilterObservable;
54325464

54335465
}(ObservableBase));
54345466

5435-
function FilterObserver(observer, predicate, source) {
5436-
this.observer = observer;
5437-
this.predicate = predicate;
5438-
this.source = source;
5439-
this.i = 0;
5440-
this.isStopped = false;
5441-
}
5442-
5443-
FilterObserver.prototype.onNext = function(x) {
5444-
if (this.isStopped) { return; }
5445-
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
5446-
if (shouldYield === errorObj) {
5447-
return this.observer.onError(shouldYield.e);
5448-
}
5449-
shouldYield && this.observer.onNext(x);
5450-
};
5451-
FilterObserver.prototype.onError = function (e) {
5452-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
5453-
};
5454-
FilterObserver.prototype.onCompleted = function () {
5455-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
5456-
};
5457-
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
5458-
FilterObserver.prototype.fail = function (e) {
5459-
if (!this.isStopped) {
5460-
this.isStopped = true;
5461-
this.observer.onError(e);
5462-
return true;
5463-
}
5464-
return false;
5465-
};
5466-
54675467
/**
54685468
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
54695469
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

dist/rx.all.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.compat.min.js

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.js

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4896,47 +4896,47 @@
48964896
return new MapObservable(this.source, innerMap(selector, this), thisArg);
48974897
};
48984898

4899-
MapObservable.prototype.subscribeCore = function (observer) {
4900-
return this.source.subscribe(new MapObserver(observer, this.selector, this));
4899+
MapObservable.prototype.subscribeCore = function (o) {
4900+
return this.source.subscribe(new InnerObserver(o, this.selector, this));
4901+
};
4902+
4903+
function InnerObserver(o, selector, source) {
4904+
this.o = o;
4905+
this.selector = selector;
4906+
this.source = source;
4907+
this.i = 0;
4908+
this.isStopped = false;
4909+
}
4910+
4911+
InnerObserver.prototype.onNext = function(x) {
4912+
if (this.isStopped) { return; }
4913+
var result = tryCatch(this.selector)(x, this.i++, this.source);
4914+
if (result === errorObj) {
4915+
return this.o.onError(result.e);
4916+
}
4917+
this.o.onNext(result);
4918+
};
4919+
InnerObserver.prototype.onError = function (e) {
4920+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
4921+
};
4922+
InnerObserver.prototype.onCompleted = function () {
4923+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
4924+
};
4925+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
4926+
InnerObserver.prototype.fail = function (e) {
4927+
if (!this.isStopped) {
4928+
this.isStopped = true;
4929+
this.o.onError(e);
4930+
return true;
4931+
}
4932+
4933+
return false;
49014934
};
49024935

49034936
return MapObservable;
49044937

49054938
}(ObservableBase));
49064939

4907-
function MapObserver(observer, selector, source) {
4908-
this.observer = observer;
4909-
this.selector = selector;
4910-
this.source = source;
4911-
this.i = 0;
4912-
this.isStopped = false;
4913-
}
4914-
4915-
MapObserver.prototype.onNext = function(x) {
4916-
if (this.isStopped) { return; }
4917-
var result = tryCatch(this.selector)(x, this.i++, this.source);
4918-
if (result === errorObj) {
4919-
return this.observer.onError(result.e);
4920-
}
4921-
this.observer.onNext(result);
4922-
};
4923-
MapObserver.prototype.onError = function (e) {
4924-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
4925-
};
4926-
MapObserver.prototype.onCompleted = function () {
4927-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
4928-
};
4929-
MapObserver.prototype.dispose = function() { this.isStopped = true; };
4930-
MapObserver.prototype.fail = function (e) {
4931-
if (!this.isStopped) {
4932-
this.isStopped = true;
4933-
this.observer.onError(e);
4934-
return true;
4935-
}
4936-
4937-
return false;
4938-
};
4939-
49404940
/**
49414941
* Projects each element of an observable sequence into a new form by incorporating the element's index.
49424942
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
@@ -5271,8 +5271,8 @@
52715271
__super__.call(this);
52725272
}
52735273

5274-
FilterObservable.prototype.subscribeCore = function (observer) {
5275-
return this.source.subscribe(new FilterObserver(observer, this.predicate, this));
5274+
FilterObservable.prototype.subscribeCore = function (o) {
5275+
return this.source.subscribe(new InnerObserver(o, this.predicate, this));
52765276
};
52775277

52785278
function innerPredicate(predicate, self) {
@@ -5282,43 +5282,43 @@
52825282
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
52835283
return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);
52845284
};
5285+
5286+
function InnerObserver(o, predicate, source) {
5287+
this.o = o;
5288+
this.predicate = predicate;
5289+
this.source = source;
5290+
this.i = 0;
5291+
this.isStopped = false;
5292+
}
5293+
5294+
InnerObserver.prototype.onNext = function(x) {
5295+
if (this.isStopped) { return; }
5296+
var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);
5297+
if (shouldYield === errorObj) {
5298+
return this.o.onError(shouldYield.e);
5299+
}
5300+
shouldYield && this.o.onNext(x);
5301+
};
5302+
InnerObserver.prototype.onError = function (e) {
5303+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
5304+
};
5305+
InnerObserver.prototype.onCompleted = function () {
5306+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
5307+
};
5308+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
5309+
InnerObserver.prototype.fail = function (e) {
5310+
if (!this.isStopped) {
5311+
this.isStopped = true;
5312+
this.o.onError(e);
5313+
return true;
5314+
}
5315+
return false;
5316+
};
52855317

52865318
return FilterObservable;
52875319

52885320
}(ObservableBase));
52895321

5290-
function FilterObserver(observer, predicate, source) {
5291-
this.observer = observer;
5292-
this.predicate = predicate;
5293-
this.source = source;
5294-
this.i = 0;
5295-
this.isStopped = false;
5296-
}
5297-
5298-
FilterObserver.prototype.onNext = function(x) {
5299-
if (this.isStopped) { return; }
5300-
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
5301-
if (shouldYield === errorObj) {
5302-
return this.observer.onError(shouldYield.e);
5303-
}
5304-
shouldYield && this.observer.onNext(x);
5305-
};
5306-
FilterObserver.prototype.onError = function (e) {
5307-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
5308-
};
5309-
FilterObserver.prototype.onCompleted = function () {
5310-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
5311-
};
5312-
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
5313-
FilterObserver.prototype.fail = function (e) {
5314-
if (!this.isStopped) {
5315-
this.isStopped = true;
5316-
this.observer.onError(e);
5317-
return true;
5318-
}
5319-
return false;
5320-
};
5321-
53225322
/**
53235323
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
53245324
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

dist/rx.all.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)