Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function empty(suite) {
var oldEmptyWithImmediateScheduler = RxOld.Observable.empty(RxOld.Scheduler.immediate);
var newEmptyWithImmediateScheduler = RxNew.Observable.empty();
function _next(x) { }
function _error(e) { }
function _complete() { }
// add tests
return suite
.add('old empty with immediate scheduler', function () {
oldEmptyWithImmediateScheduler.subscribe(_next, _error, _complete);
})
.add('new empty with immediate scheduler', function () {
newEmptyWithImmediateScheduler.subscribe(_next, _error, _complete);
});
};
module.exports = function (suite) {
var oldMergeMapWithImmediateScheduler = RxOld.Observable.range(0, 25, RxOld.Scheduler.immediate)
.flatMap(RxOld.Observable.return(0, RxOld.Scheduler.immediate));
var newMergeMapWithImmediateScheduler = RxNew.Observable.range(0, 25)
.mergeMapTo(RxNew.Observable.of(0));
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old mergeMap (scalar Observable) with immediate scheduler', function () {
oldMergeMapWithImmediateScheduler.subscribe(_next, _error, _complete);
})
.add('new mergeMap (scalar Observable) with immediate scheduler', function () {
newMergeMapWithImmediateScheduler.subscribe(_next, _error, _complete);
});
};
module.exports = function (suite) {
var oldIgnoreElementsWithCurrentThreadScheduler = RxOld.Observable.range(0, 50, RxOld.Scheduler.currentThread).ignoreElements();
var newIgnoreElementsWithCurrentThreadScheduler = RxNew.Observable.range(0, 50, RxNew.Scheduler.queue).ignoreElements();
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old ignoreElements with current thread scheduler', function () {
oldIgnoreElementsWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
})
.add('new ignoreElements with current thread scheduler', function () {
newIgnoreElementsWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
});
};
module.exports = function (suite) {
var predicate = function (x) {
return x < 50;
};
var oldEveryPredicateArgs = RxOld.Observable.range(0, 25, RxOld.Scheduler.immediate).every(predicate);
var newEveryPredicateArgs = RxNew.Observable.range(0, 25).every(predicate);
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old every(predicate) with immediate scheduler', function () {
oldEveryPredicateArgs.subscribe(_next, _error, _complete);
})
.add('new every(predicate) with immediate scheduler', function () {
newEveryPredicateArgs.subscribe(_next, _error, _complete);
});
};
.add('old from (string) with immediate scheduler', function () {
RxOld.Observable.from(argStr, null, null, RxOld.Scheduler.immediate).subscribe(_next, _error, _complete);
})
.add('new from (string) with immediate scheduler', function () {
module.exports = function (suite) {
var oldMergeMapWithCurrentThreadScheduler = RxOld.Observable.range(0, 25, RxOld.Scheduler.currentThread)
.flatMap(RxOld.Observable.range(0, 25, RxOld.Scheduler.currentThread));
var newMergeMapWithCurrentThreadScheduler = RxNew.Observable.range(0, 25, RxNew.Scheduler.queue)
.mergeMapTo(RxNew.Observable.range(0, 25, RxNew.Scheduler.queue));
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old mergeMap (Observable) with current thread scheduler', function () {
oldMergeMapWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
})
.add('new mergeMap (Observable) with current thread scheduler', function () {
newMergeMapWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
});
};
module.exports = function forkJoin(suite) {
var oldForkJoinWithImmediateScheduler = RxOld.Observable.forkJoin(
RxOld.Observable.of(25, RxOld.Scheduler.immediate),
RxOld.Observable.range(0, 25, RxOld.Scheduler.immediate),
RxOld.Observable.from([1, 2, 3, 4, 5], null, this, RxOld.Scheduler.immediate));
var newForkJoinWithImmediateScheduler = RxNew.Observable.forkJoin(
RxNew.Observable.of(25),
RxNew.Observable.range(0,25),
RxNew.Observable.from([1, 2, 3, 4, 5]));
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old forkJoin() with immediate scheduler', function () {
oldForkJoinWithImmediateScheduler.subscribe(_next, _error, _complete);
})
.add('new forkJoin() with immediate scheduler', function () {
newForkJoinWithImmediateScheduler.subscribe(_next, _error, _complete);
module.exports = function (suite) {
var oldDelayWithImmediateScheduler = RxOld.Observable.of(25, RxOld.Scheduler.immediate).delay(25);
var newDelayWithImmediateScheduler = RxNew.Observable.of(25).delay(25);
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old delay with immediate scheduler', function () {
oldDelayWithImmediateScheduler.subscribe(_next, _error, _complete);
})
.add('new delay with immediate scheduler', function () {
newDelayWithImmediateScheduler.subscribe(_next, _error, _complete);
});
};
module.exports = function (suite) {
var oldLastNoArgs = RxOld.Observable.range(0, 50, RxOld.Scheduler.immediate).last();
var newLastNoArgs = RxNew.Observable.range(0, 50).last();
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old last() with immediate scheduler', function () {
oldLastNoArgs.subscribe(_next, _error, _complete);
})
.add('new last() with immediate scheduler', function () {
newLastNoArgs.subscribe(_next, _error, _complete);
});
};
module.exports = function (suite) {
var source = Array.apply(null, { length: 25 }).map(function (item, index) {
return { key: index % 5 };
});
function group(x) {
return x.key;
}
var oldGroupByWithImmediateScheduler = RxOld.Observable.from(source, null, this, RxOld.Scheduler.immediate)
.groupBy(group);
var newGroupByWithImmediateScheduler = RxNew.Observable.from(source)
.groupBy(group);
function _next(x) { }
function _error(e) { }
function _complete() { }
return suite
.add('old groupBy with immediate scheduler', function () {
oldGroupByWithImmediateScheduler.subscribe(_next, _error, _complete);
})
.add('new groupBy with immediate scheduler', function () {
newGroupByWithImmediateScheduler.subscribe(_next, _error, _complete);
});
};