Socket
Socket
Sign inDemoInstall

observable-operators

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.7.0

lib/delay.js

6

lib/flatMap.js

@@ -37,3 +37,3 @@ 'use strict';

return new Observable(function (observer) {
var subscriptions = new Map();
var subscriptions = new Set();
var completed = void 0;

@@ -51,3 +51,3 @@

this.subscription = subs;
subscriptions.set(this.subscription, true);
subscriptions.add(this.subscription);
},

@@ -85,3 +85,3 @@ next: function next(val) {

return function () {
subscriptions.forEach(function (_, subscription) {
subscriptions.forEach(function (subscription) {
return subscription.unsubscribe();

@@ -88,0 +88,0 @@ });

@@ -6,3 +6,3 @@ 'use strict';

});
exports.transform = exports.toArray = exports.skipUntil = exports.takeUntil = exports.takeLast = exports.take = exports.startWith = exports.skipLast = exports.skip = exports.scan = exports.reduce = exports.merge = exports.map = exports.interval = exports.fromPromise = exports.fromEvent = exports.forEach = exports.flatMap = exports.filter = exports.error = exports.defer = exports.debounce = exports.concat = exports.catchError = exports.addOperators = exports.addAll = exports.default = undefined;
exports.transform = exports.toArray = exports.skipUntil = exports.throttle = exports.takeUntil = exports.takeLast = exports.take = exports.startWith = exports.skipLast = exports.skip = exports.scan = exports.reduce = exports.merge = exports.map = exports.interval = exports.fromPromise = exports.fromEvent = exports.forEach = exports.flatMap = exports.filter = exports.error = exports.delay = exports.defer = exports.debounce = exports.concat = exports.catchError = exports.addOperators = exports.addAll = exports.default = undefined;

@@ -33,2 +33,6 @@ var _addOperators = require('./addOperators');

var _delay = require('./delay');
var _delay2 = _interopRequireDefault(_delay);
var _error = require('./error');

@@ -106,2 +110,6 @@

var _throttle = require('./throttle');
var _throttle2 = _interopRequireDefault(_throttle);
var _toArray = require('./toArray');

@@ -122,3 +130,3 @@

(0, _addOperators2.default)(target.prototype, [_catchError2.default, _concat2.default, _debounce2.default, _filter2.default, _flatMap2.default, _forEach2.default, _map2.default, _merge2.default, _reduce2.default, _scan2.default, _skip2.default, _skipLast2.default, _skipUntil2.default, _startWith2.default, _take2.default, _takeLast2.default, _takeUntil2.default, _toArray2.default, _transform2.default]);
(0, _addOperators2.default)(target.prototype, [_catchError2.default, _concat2.default, _debounce2.default, _delay2.default, _filter2.default, _flatMap2.default, _forEach2.default, _map2.default, _merge2.default, _reduce2.default, _scan2.default, _skip2.default, _skipLast2.default, _skipUntil2.default, _startWith2.default, _take2.default, _takeLast2.default, _takeUntil2.default, _throttle2.default, _toArray2.default, _transform2.default]);
};

@@ -133,2 +141,3 @@

exports.defer = _defer2.default;
exports.delay = _delay2.default;
exports.error = _error2.default;

@@ -151,4 +160,5 @@ exports.filter = _filter2.default;

exports.takeUntil = _takeUntil2.default;
exports.throttle = _throttle2.default;
exports.skipUntil = _skipUntil2.default;
exports.toArray = _toArray2.default;
exports.transform = _transform2.default;
{
"name": "observable-operators",
"version": "1.6.0",
"version": "1.7.0",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "module": "src/index.js",

@@ -107,4 +107,4 @@ # ObservableOperators

```
If used directly as a function they will return an instance of the global Observable constructor.
If used directly as a function they will return an instance of the global Observable constructor.
The helper function `addCreators` is used to add creators to the Observable constructor as part of the library's root method. If you wish to cherrypick creators you may do so:

@@ -120,6 +120,34 @@

As of now this library is set up with a very small set of Operators and Creators to get the project going. A list of all available methods and accompanying documentation is found [here](https://nmuldavin.github.io/ObservableOperators/). Quite clearly this is nowhere near complete, pull requests gladly accepted!
### Creators
* [defer](https://nmuldavin.github.io/ObservableOperators/#defer)
* [error](https://nmuldavin.github.io/ObservableOperators/#error)
* [fromEvent](https://nmuldavin.github.io/ObservableOperators/#fromEvent)
* [fromPromise](https://nmuldavin.github.io/ObservableOperators/#fromPromise)
* [interval](https://nmuldavin.github.io/ObservableOperators/#interval)
### Operators
* [catchError](https://nmuldavin.github.io/ObservableOperators/#catcherror)
* [concat](https://nmuldavin.github.io/ObservableOperators/#concat)
* [debounce](https://nmuldavin.github.io/ObservableOperators/#debounce)
* [delay](https://nmuldavin.github.io/ObservableOperators/#delay)
* [filter](https://nmuldavin.github.io/ObservableOperators/#filter)
* [flatMap](https://nmuldavin.github.io/ObservableOperators/#flatmap)
* [forEach](https://nmuldavin.github.io/ObservableOperators/#foreach)
* [map](https://nmuldavin.github.io/ObservableOperators/#map)
* [merge](https://nmuldavin.github.io/ObservableOperators/#merge)
* [reduce](https://nmuldavin.github.io/ObservableOperators/#reduce)
* [scan](https://nmuldavin.github.io/ObservableOperators/#scan)
* [skip](https://nmuldavin.github.io/ObservableOperators/#skip)
* [skipLast](https://nmuldavin.github.io/ObservableOperators/#skiplast)
* [skipUntil](https://nmuldavin.github.io/ObservableOperators/#skipUntil)
* [startWith](https://nmuldavin.github.io/ObservableOperators/#startWith)
* [take](https://nmuldavin.github.io/ObservableOperators/#take)
* [takeLast](https://nmuldavin.github.io/ObservableOperators/#takeLast)
* [takeUntil](https://nmuldavin.github.io/ObservableOperators/#takeUntil)
* [throttle](https://nmuldavin.github.io/ObservableOperators/#throttle)
* [toArray](https://nmuldavin.github.io/ObservableOperators/#toarray)
* [transform](https://nmuldavin.github.io/ObservableOperators/#transform)
## Motivation
There are great existing reactive observable libraries out there already such as [most.js](https://github.com/cujojs/most) and [RxJS](https://github.com/Reactive-Extensions/RxJS), but none of them that are built from the bottom up on top of the [ECMAScript Observable](https://github.com/tc39/proposal-observables) proposal that will inevitably be part of the language. This is that library.
There are great existing reactive observable libraries out there already such as [most.js](https://github.com/cujojs/most) and [RxJS](https://github.com/Reactive-Extensions/RxJS), but none of them that are built from the bottom up on top of the [ECMAScript Observable](https://github.com/tc39/proposal-observables) proposal that will (hopefully) be part of the language.

@@ -32,3 +32,3 @@ /**

new Observable(observer => {
const subscriptions = new Map();
const subscriptions = new Set();
let completed;

@@ -46,3 +46,3 @@

this.subscription = subs;
subscriptions.set(this.subscription, true);
subscriptions.add(this.subscription);
},

@@ -80,3 +80,3 @@ next(val) {

return () => {
subscriptions.forEach((_, subscription) => subscription.unsubscribe());
subscriptions.forEach(subscription => subscription.unsubscribe());
rootSubscription.unsubscribe();

@@ -83,0 +83,0 @@ };

@@ -8,2 +8,3 @@ import addOperators from './addOperators';

import defer from './defer';
import delay from './delay';
import error from './error';

@@ -27,2 +28,3 @@ import filter from './filter';

import takeUntil from './takeUntil';
import throttle from './throttle';
import toArray from './toArray';

@@ -38,2 +40,3 @@ import transform from './transform';

debounce,
delay,
filter,

@@ -53,2 +56,3 @@ flatMap,

takeUntil,
throttle,
toArray,

@@ -67,2 +71,3 @@ transform,

defer,
delay,
error,

@@ -85,2 +90,3 @@ filter,

takeUntil,
throttle,
skipUntil,

@@ -87,0 +93,0 @@ toArray,

@@ -75,2 +75,13 @@ import { expect } from 'chai';

});
it('propagates errors from the input observable', () => {
const errorObservable = new Observable(observer => observer.error('error'));
const errorHandler = sinon.spy();
debounce(errorObservable, 50).subscribe({
error: errorHandler,
});
expect(errorHandler).to.have.been.calledWith('error');
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc