[Snyk] Upgrade rx from 4.0.8 to 4.1.0 #114
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was automatically created by Snyk using the credentials of a real user.
Snyk has created this PR to upgrade rx from 4.0.8 to 4.1.0.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Release notes
Package name: rx
We are happy to announce the release of RxJS version 4.1. With this release came a few new additions as well as a new system for pulling in what you want.
Some of the changes are the following:
@ rxjs/rx
repeatWhen
Build What You Want with
@ rxjs/rx
One of the biggest requests with RxJS was to build only what you wanted. In previous attempts, we looked at a CLI to build what you wanted, but that was suboptimal experience. Instead, we have ported the existing code base to CommonJS format so that it works right out of the box with Node.js, or with your favorite bundler whether it is Browserify, Webpack, Rollup, etc.
By default, this brings in all of RxJS when you require the
@ rxjs/rx
module:const subscription = Rx.Observable.from([1,2,3])
.filter(x => x % 2 === 0)
.map(x => x + 2)
.subscribe(x => console.log(
The answer is <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>
));// => The answer is 4
Now it is possible to bring in as much or as little as you want by only including the operators you want:
const filter = require('@ rxjs/rx/observable/filter');
const map = require('@ rxjs/rx/observable/map');
const source = fromArray([1,2,3]);
const filtered = filter(source, x => x % 2 === 0);
const mapped = map(filtered, x => x + 2);
const subscription = mapped.subscribe( x => console.log(
The answer is <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>
) );// => The answer is 4
Not only can you bring in certain operators, but you can also add each one to the prototype if you want the nice chaining feature as well.
// Add class methods
Observable.addToObject({
fromArray: require('@ rxjs/rx/observable/fromarray')
});
// Add instance methods
Observable.addToPrototype({
filter: require('@ rxjs/rx/observable/filter'),
map: require('@ rxjs/rx/observable/map')
});
const subscription = Observable.fromArray([1,2,3])
.filter(x => x % 2 === 0)
.map(x => x + 2)
.subscribe(x => console.log(
The answer is <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>
));In addition, we also added some distributions that you will find under our
src/modular/dist
folder which contains all of RxJS built in a UMD style as well as a "lite" version as well. This should give you the building blocks for creating your own builds of RxJS and taking the only the operators you need.Adding
repeatWhen
We often try to keep parity with other Rx versions such as RxJava. To that end, we've added
repeatWhen
which complements theretryWhen
we've had for quite some time. Rather than buffering and replaying the sequence from the source Observable, therepeatWhen
resubscribes to and mirrors the source Observable, but only conditionally based upon the Observable you return from the call.Here is an example where we can repeat a sequence twice with a delay of 200ms in between time.
.repeatWhen(function(notifications) {
return notifications.scan((acc, x) => return acc + x, 0)
.delay(200)
.takeWhile(count => count < 2);
});
var subscription = source.subscribe(
x => console.log(
Next <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">x</span><span class="pl-kos">}</span></span>
,err => console.log(
Error <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">err</span><span class="pl-kos">}</span></span>
),() => console.log('Completed')
);
// => Next: 42
// 200 ms pass
// => Next: 42
// 200 ms pass
// => Completed
Parity with RxJS v5 names
Given the differences between RxJS v4 and RxJS v5, we've made the migration path easier by creating aliases for you such as the following:
Observable.prototype.race = Observable.prototype.amb;
Observable.prototype.mergeMap = Observable.prototype.flatMap;
Observable.prototype.switchMap = Observable.prototype.flatMapLatest;
Observable.prototype.exhaustMap = Observable.prototype.flatMapFirst;
Observable.prototype.exhaust = Observable.prototype.switchFirst;
Observable.prototype.publishReplay = Observable.prototype.replay;
// Object methods
Observable.bindCallback = Observable.fromCallback;
Observable.bindNodeCallback = Observable.fromNodeCallback;
Observable.race = Observable.amb;
Other Changes
ConnectableObservable
so that if the underlyingSubject
has been disposed, we will no longer attempt to resubscribe to it.startWith
operator no longer usesScheduler.currentThread
and now usesScheduler.immediate
, as that caused issues with the backpressure operators such aspausable
andpausableBuffered
.RxJS version 4.0.8
Commit messages
Package name: rx
Compare
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs