light-observable
Advanced tools
Comparing version 1.3.0 to 1.4.0
import { getSpecies } from '../helpers/getSpecies'; | ||
export function merge(...streams) { | ||
return (stream) => { | ||
const C = getSpecies(stream); | ||
const allStreams = [stream].concat(streams); | ||
return (otherStream) => { | ||
const C = getSpecies(otherStream); | ||
const allStreams = [otherStream].concat(streams); | ||
return new C((observer) => { | ||
let numObservers = allStreams.length; | ||
const subscriptions = allStreams.map((operator) => { | ||
return operator.subscribe({ | ||
const subscriptions = allStreams.map((stream) => { | ||
return stream.subscribe({ | ||
next(value) { | ||
@@ -11,0 +11,0 @@ observer.next(value); |
@@ -1,2 +0,1 @@ | ||
export declare const $$iterator: any; | ||
export declare const $$observable: any; | ||
export declare const getSymbol: (name: string) => any; |
@@ -1,6 +0,4 @@ | ||
const getSymbol = (name) => { | ||
export const getSymbol = (name) => { | ||
return (typeof Symbol === 'function' && Symbol[name]) || '@@' + name; | ||
}; | ||
export const $$iterator = getSymbol('iterator'); | ||
export const $$observable = getSymbol('observable'); | ||
//# sourceMappingURL=symbols.js.map |
import { enqueue } from './helpers/enqueue'; | ||
import { $$iterator, $$observable } from './helpers/symbols'; | ||
import { getSymbol } from './helpers/symbols'; | ||
import { ObservableSubscription } from './ObservableSubscription'; | ||
@@ -39,4 +39,4 @@ const fromArray = (arrayLike) => { | ||
} | ||
if (ish[$$observable]) { | ||
const observable = ish[$$observable](); | ||
if (ish[getSymbol('observable')]) { | ||
const observable = ish[getSymbol('observable')](); | ||
if (Object(observable) !== observable) { | ||
@@ -50,4 +50,4 @@ throw new TypeError(error); | ||
} | ||
if (ish[$$iterator]) { | ||
return new C(fromArray(ish[$$iterator]())); | ||
if (ish[getSymbol('iterator')]) { | ||
return new C(fromArray(ish[getSymbol('iterator')]())); | ||
} | ||
@@ -75,3 +75,3 @@ // For old browsers that doesn't support @@iterator | ||
} | ||
[$$observable]() { | ||
[getSymbol('observable')]() { | ||
return this; | ||
@@ -78,0 +78,0 @@ } |
@@ -13,4 +13,2 @@ 'use strict'; | ||
}; | ||
const $$iterator = getSymbol('iterator'); | ||
const $$observable = getSymbol('observable'); | ||
@@ -190,4 +188,4 @@ function cleanupSubscription(subscription) { | ||
} | ||
if (ish[$$observable]) { | ||
const observable = ish[$$observable](); | ||
if (ish[getSymbol('observable')]) { | ||
const observable = ish[getSymbol('observable')](); | ||
if (Object(observable) !== observable) { | ||
@@ -201,4 +199,4 @@ throw new TypeError(error); | ||
} | ||
if (ish[$$iterator]) { | ||
return new C(fromArray(ish[$$iterator]())); | ||
if (ish[getSymbol('iterator')]) { | ||
return new C(fromArray(ish[getSymbol('iterator')]())); | ||
} | ||
@@ -226,3 +224,3 @@ // For old browsers that doesn't support @@iterator | ||
} | ||
[$$observable]() { | ||
[getSymbol('observable')]() { | ||
return this; | ||
@@ -326,9 +324,9 @@ } | ||
function merge(...streams) { | ||
return (stream) => { | ||
const C = getSpecies(stream); | ||
const allStreams = [stream].concat(streams); | ||
return (otherStream) => { | ||
const C = getSpecies(otherStream); | ||
const allStreams = [otherStream].concat(streams); | ||
return new C((observer) => { | ||
let numObservers = allStreams.length; | ||
const subscriptions = allStreams.map((operator) => { | ||
return operator.subscribe({ | ||
const subscriptions = allStreams.map((stream) => { | ||
return stream.subscribe({ | ||
next(value) { | ||
@@ -335,0 +333,0 @@ observer.next(value); |
{ | ||
"name": "light-observable", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Light observable ponyfill", | ||
@@ -85,2 +85,3 @@ "main": "lib/index.js", | ||
"prettier": "^1.13.6", | ||
"redux": "^4.0.0", | ||
"rollup": "^0.62.0", | ||
@@ -87,0 +88,0 @@ "rollup-plugin-commonjs": "^9.1.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63033
24
933