File rx.lite.js
has 5116 lines of code (exceeds 250 allowed). Consider refactoring.
;(function (undefined) {
var objectTypes = {
Function ReplaySubject
has 92 lines of code (exceeds 25 allowed). Consider refactoring.
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
var maxSafeInteger = Math.pow(2, 53) - 1;
function createRemovableDisposable(subject, observer) {
Function ControlledSubject
has 84 lines of code (exceeds 25 allowed). Consider refactoring.
var ControlledSubject = (function (__super__) {
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue, scheduler) {
enableQueue == null && (enableQueue = true);
Function AsyncSubject
has 73 lines of code (exceeds 25 allowed). Consider refactoring.
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
inherits(AsyncSubject, __super__);
* Creates a subject that can only receive one value and that value is cached for all future observations.
Function BehaviorSubject
has 66 lines of code (exceeds 25 allowed). Consider refactoring.
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
inherits(BehaviorSubject, __super__);
function BehaviorSubject(value) {
__super__.call(this);
this.value = value;
Function Subject
has 62 lines of code (exceeds 25 allowed). Consider refactoring.
var Subject = Rx.Subject = (function (__super__) {
inherits(Subject, __super__);
function Subject() {
__super__.call(this);
this.isDisposed = false;
Function observableDelayRelative
has 61 lines of code (exceeds 25 allowed). Consider refactoring.
function observableDelayRelative(source, dueTime, scheduler) {
return new AnonymousObservable(function (o) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
Function RetryWhenObservable
has 58 lines of code (exceeds 25 allowed). Consider refactoring.
var RetryWhenObservable = (function(__super__) {
function createDisposable(state) {
return {
isDisposed: false,
dispose: function () {
Function RepeatWhenObservable
has 58 lines of code (exceeds 25 allowed). Consider refactoring.
var RepeatWhenObservable = (function(__super__) {
function createDisposable(state) {
return {
isDisposed: false,
dispose: function () {
Function PausableBufferedObservable
has 56 lines of code (exceeds 25 allowed). Consider refactoring.
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
Function ScheduledObserver
has 52 lines of code (exceeds 25 allowed). Consider refactoring.
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
Function SwitchObservable
has 51 lines of code (exceeds 25 allowed). Consider refactoring.
var SwitchObservable = (function(__super__) {
inherits(SwitchObservable, __super__);
function SwitchObservable(source) {
this.source = source;
__super__.call(this);
Function DefaultScheduler
has 49 lines of code (exceeds 25 allowed). Consider refactoring.
var DefaultScheduler = (function (__super__) {
inherits(DefaultScheduler, __super__);
function DefaultScheduler() {
__super__.call(this);
}
Function baseIsEqualDeep
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
function baseIsEqualDeep(object, other, equalFunc, isLoose, stackA, stackB) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
Function timeoutWithSelector
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
function timeoutWithSelector(source, firstTimeout, timeoutDurationSelector, other) {
if (isFunction(firstTimeout)) {
other = timeoutDurationSelector;
timeoutDurationSelector = firstTimeout;
firstTimeout = observableNever();
Function MergeDelayErrorObserver
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
var MergeDelayErrorObserver = (function(__super__) {
inherits(MergeDelayErrorObserver, __super__);
function MergeDelayErrorObserver(group, state) {
this._group = group;
this._state = state;
Function delayWithSelector
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
function delayWithSelector(source, subscriptionDelay, delayDurationSelector) {
var subDelay, selector;
if (isFunction(subscriptionDelay)) {
selector = subscriptionDelay;
} else {
Function MergeObserver
has 44 lines of code (exceeds 25 allowed). Consider refactoring.
var MergeObserver = (function (__super__) {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
Function combineLatestSource
has 44 lines of code (exceeds 25 allowed). Consider refactoring.
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (o) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
Function timeout
has 44 lines of code (exceeds 25 allowed). Consider refactoring.
function timeout(source, dueTime, other, scheduler) {
if (isScheduler(other)) {
scheduler = other;
other = observableThrow(new TimeoutError());
}
Function debounceWithSelector
has 42 lines of code (exceeds 25 allowed). Consider refactoring.
function debounceWithSelector(source, durationSelector) {
return new AnonymousObservable(function (o) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
var subscription = source.subscribe(
function (x) {
Function DebounceObserver
has 39 lines of code (exceeds 25 allowed). Consider refactoring.
var DebounceObserver = (function (__super__) {
inherits(DebounceObserver, __super__);
function DebounceObserver(observer, dueTime, scheduler, cancelable) {
this._o = observer;
this._d = dueTime;
Function CatchErrorObservable
has 38 lines of code (exceeds 25 allowed). Consider refactoring.
var CatchErrorObservable = (function(__super__) {
function CatchErrorObservable(sources) {
this.sources = sources;
__super__.call(this);
}
Function subscribeCore
has 38 lines of code (exceeds 25 allowed). Consider refactoring.
RetryWhenObservable.prototype.subscribeCore = function (o) {
var exceptions = new Subject(),
notifier = new Subject(),
handled = this._notifier(exceptions),
notificationDisposable = handled.subscribe(notifier);
Function subscribeCore
has 38 lines of code (exceeds 25 allowed). Consider refactoring.
RepeatWhenObservable.prototype.subscribeCore = function (o) {
var completions = new Subject(),
notifier = new Subject(),
handled = this._notifier(completions),
notificationDisposable = handled.subscribe(notifier);
Function MergeAllObserver
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
var MergeAllObserver = (function (__super__) {
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.done = false;
Function FilterObservable
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
var FilterObservable = (function (__super__) {
inherits(FilterObservable, __super__);
function FilterObservable(source, predicate, thisArg) {
this.source = source;
Function Observable
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
var Observable = Rx.Observable = (function () {
function makeSubscribe(self, subscribe) {
return function (o) {
var oldOnError = o.onError;
Function ConcatEnumerableObservable
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
var ConcatEnumerableObservable = (function(__super__) {
inherits(ConcatEnumerableObservable, __super__);
function ConcatEnumerableObservable(sources) {
this.sources = sources;
__super__.call(this);
Function equalObjects
has 36 lines of code (exceeds 25 allowed). Consider refactoring.
function equalObjects(object, other, equalFunc, isLoose, stackA, stackB) {
var objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
Function ConnectableObservable
has 36 lines of code (exceeds 25 allowed). Consider refactoring.
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
this.source = source;
this._connection = null;
Function TapObservable
has 36 lines of code (exceeds 25 allowed). Consider refactoring.
var TapObservable = (function(__super__) {
inherits(TapObservable,__super__);
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
this.source = source;
this._oN = observerOrOnNext;
Function EventPatternObservable
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
var EventPatternObservable = (function(__super__) {
inherits(EventPatternObservable, __super__);
function EventPatternObservable(add, del, fn) {
this._add = add;
this._del = del;
Function PausableObservable
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
var PausableObservable = (function (__super__) {
inherits(PausableObservable, __super__);
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
Function ZipObserver
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
var ZipObserver = (function (__super__) {
inherits(ZipObserver, __super__);
function ZipObserver(o, i, p, q, d) {
this._o = o;
this._i = i;
Function MapObservable
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
var MapObservable = (function (__super__) {
inherits(MapObservable, __super__);
function MapObservable(source, selector, thisArg) {
this.source = source;
Function FlatMapObservable
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
inherits(FlatMapObservable, __super__);
function FlatMapObservable(source, selector, resultSelector, thisArg) {
Function IgnoreElementsObservable
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
var IgnoreElementsObservable = (function(__super__) {
inherits(IgnoreElementsObservable, __super__);
function IgnoreElementsObservable(source) {
this.source = source;
Function RefCountDisposable
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
Function FromPromiseObservable
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
var FromPromiseObservable = (function(__super__) {
inherits(FromPromiseObservable, __super__);
function FromPromiseObservable(p, s) {
this._p = p;
this._s = s;
Function _subscribe
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
PausableBufferedObservable.prototype._subscribe = function (o) {
var q = [], previousShouldFire;
function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }
Function ScanObserver
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
var ScanObserver = (function (__super__) {
inherits(ScanObserver, __super__);
function ScanObserver(o, parent) {
this._o = o;
this._p = parent;
Function AbstractObserver
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
* Creates a new observer in a non-stopped state.
Function CombineLatestObserver
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
var CombineLatestObserver = (function (__super__) {
inherits(CombineLatestObserver, __super__);
function CombineLatestObserver(o, i, cb, state) {
this._o = o;
this._i = i;
Function DistinctUntilChangedObserver
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
var DistinctUntilChangedObserver = (function(__super__) {
inherits(DistinctUntilChangedObserver, __super__);
function DistinctUntilChangedObserver(o, keyFn, comparer) {
this.o = o;
this.keyFn = keyFn;
Function keys
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
var keys = Object.keys || (function() {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
Function AutoDetachObserver
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
var AutoDetachObserver = (function (__super__) {
inherits(AutoDetachObserver, __super__);
function AutoDetachObserver(observer) {
__super__.call(this);
Function ZipIterableObserver
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
var ZipIterableObserver = (function (__super__) {
inherits(ZipIterableObserver, __super__);
function ZipIterableObserver(s, i) {
this._s = s;
this._i = i;
Function ConcatObservable
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
var ConcatObservable = (function(__super__) {
inherits(ConcatObservable, __super__);
function ConcatObservable(sources) {
this._sources = sources;
__super__.call(this);
Function start
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function start() {
subscription.setDisposable(source.subscribe(
function (x) {
var delay = tryCatch(selector)(x);
if (delay === errorObj) { return o.onError(delay.e); }
Function equalArrays
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
function equalArrays(array, other, equalFunc, isLoose, stackA, stackB) {
var index = -1,
arrLength = array.length,
othLength = other.length;
Function WithLatestFromObservable
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
var WithLatestFromObservable = (function(__super__) {
inherits(WithLatestFromObservable, __super__);
function WithLatestFromObservable(source, sources, resultSelector) {
this._s = source;
this._ss = sources;
Function cancelable
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
var cancelable = currentThreadScheduler.scheduleRecursive(null, function (_, recurse) {
if (state.isDisposed) { return; }
var currentItem = e.next();
if (currentItem.done) {
Function cancelable
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
var cancelable = currentThreadScheduler.scheduleRecursive(null, function (_, recurse) {
if (state.isDisposed) { return; }
var currentItem = e.next();
if (currentItem.done) {
Function FromObservable
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
var FromObservable = (function(__super__) {
inherits(FromObservable, __super__);
function FromObservable(iterable, fn, scheduler) {
this._iterable = iterable;
this._fn = fn;
Function FinallyObservable
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
var FinallyObservable = (function (__super__) {
inherits(FinallyObservable, __super__);
function FinallyObservable(source, fn, thisArg) {
this.source = source;
this._fn = bindCallback(fn, thisArg, 0);
Function CurrentThreadScheduler
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
var CurrentThreadScheduler = (function (__super__) {
var queue;
function runTrampoline () {
while (queue.length > 0) {
Function AnonymousObservable
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
function fixSubscriber(subscriber) {
Consider simplifying this complex logical expression.
if (objCtor !== othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor === 'function' && objCtor instanceof objCtor &&
typeof othCtor === 'function' && othCtor instanceof othCtor)) {
return false;
Function baseIsEqualDeep
has 6 arguments (exceeds 4 allowed). Consider refactoring.
function baseIsEqualDeep(object, other, equalFunc, isLoose, stackA, stackB) {
Function equalArrays
has 6 arguments (exceeds 4 allowed). Consider refactoring.
function equalArrays(array, other, equalFunc, isLoose, stackA, stackB) {
Function equalObjects
has 6 arguments (exceeds 4 allowed). Consider refactoring.
function equalObjects(object, other, equalFunc, isLoose, stackA, stackB) {
Consider simplifying this complex logical expression.
if (hasStacks &&
observable.stack &&
typeof error === 'object' &&
error !== null &&
error.stack &&
Function baseIsEqual
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function baseIsEqual(value, other, isLoose, stackA, stackB) {
Function ZipObserver
has 5 arguments (exceeds 4 allowed). Consider refactoring.
function ZipObserver(o, i, p, q, d) {
Function ScheduledItem
has 5 arguments (exceeds 4 allowed). Consider refactoring.
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
Avoid too many return
statements within this function.
return true;
Avoid too many return
statements within this function.
return true;
Avoid too many return
statements within this function.
return result;
Avoid too many return
statements within this function.
return len;
Similar blocks of code found in 2 locations. Consider refactoring.
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
var maxSafeInteger = Math.pow(2, 53) - 1;
function createRemovableDisposable(subject, observer) {
Similar blocks of code found in 4 locations. Consider refactoring.
(function () {
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
clearMethod = function (handle) {
Similar blocks of code found in 3 locations. Consider refactoring.
var ControlledSubject = (function (__super__) {
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue, scheduler) {
enableQueue == null && (enableQueue = true);
Similar blocks of code found in 3 locations. Consider refactoring.
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
inherits(AsyncSubject, __super__);
* Creates a subject that can only receive one value and that value is cached for all future observations.
Similar blocks of code found in 3 locations. Consider refactoring.
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
inherits(BehaviorSubject, __super__);
function BehaviorSubject(value) {
__super__.call(this);
this.value = value;
Similar blocks of code found in 3 locations. Consider refactoring.
var MergeDelayErrorObserver = (function(__super__) {
inherits(MergeDelayErrorObserver, __super__);
function MergeDelayErrorObserver(group, state) {
this._group = group;
this._state = state;
Similar blocks of code found in 3 locations. Consider refactoring.
var MergeObserver = (function (__super__) {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
Similar blocks of code found in 3 locations. Consider refactoring.
var SwitchObservable = (function(__super__) {
inherits(SwitchObservable, __super__);
function SwitchObservable(source) {
this.source = source;
__super__.call(this);
Similar blocks of code found in 2 locations. Consider refactoring.
var Subject = Rx.Subject = (function (__super__) {
inherits(Subject, __super__);
function Subject() {
__super__.call(this);
this.isDisposed = false;
Similar blocks of code found in 4 locations. Consider refactoring.
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
Identical blocks of code found in 3 locations. Consider refactoring.
function observableDelayRelative(source, dueTime, scheduler) {
return new AnonymousObservable(function (o) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
Similar blocks of code found in 3 locations. Consider refactoring.
var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
inherits(FlatMapObservable, __super__);
function FlatMapObservable(source, selector, resultSelector, thisArg) {
Similar blocks of code found in 3 locations. Consider refactoring.
var CatchErrorObservable = (function(__super__) {
function CatchErrorObservable(sources) {
this.sources = sources;
__super__.call(this);
}
Similar blocks of code found in 3 locations. Consider refactoring.
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
Similar blocks of code found in 3 locations. Consider refactoring.
var RepeatWhenObservable = (function(__super__) {
function createDisposable(state) {
return {
isDisposed: false,
dispose: function () {
Similar blocks of code found in 3 locations. Consider refactoring.
var RetryWhenObservable = (function(__super__) {
function createDisposable(state) {
return {
isDisposed: false,
dispose: function () {
Similar blocks of code found in 3 locations. Consider refactoring.
var TapObservable = (function(__super__) {
inherits(TapObservable,__super__);
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
this.source = source;
this._oN = observerOrOnNext;
Similar blocks of code found in 3 locations. Consider refactoring.
var DebounceObserver = (function (__super__) {
inherits(DebounceObserver, __super__);
function DebounceObserver(observer, dueTime, scheduler, cancelable) {
this._o = observer;
this._d = dueTime;
Similar blocks of code found in 4 locations. Consider refactoring.
var Observable = Rx.Observable = (function () {
function makeSubscribe(self, subscribe) {
return function (o) {
var oldOnError = o.onError;
Similar blocks of code found in 3 locations. Consider refactoring.
var ConcatEnumerableObservable = (function(__super__) {
inherits(ConcatEnumerableObservable, __super__);
function ConcatEnumerableObservable(sources) {
this.sources = sources;
__super__.call(this);
Similar blocks of code found in 3 locations. Consider refactoring.
function timeoutWithSelector(source, firstTimeout, timeoutDurationSelector, other) {
if (isFunction(firstTimeout)) {
other = timeoutDurationSelector;
timeoutDurationSelector = firstTimeout;
firstTimeout = observableNever();
Similar blocks of code found in 3 locations. Consider refactoring.
var MergeAllObserver = (function (__super__) {
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.done = false;
Similar blocks of code found in 3 locations. Consider refactoring.
var ZipIterableObserver = (function (__super__) {
inherits(ZipIterableObserver, __super__);
function ZipIterableObserver(s, i) {
this._s = s;
this._i = i;
Similar blocks of code found in 3 locations. Consider refactoring.
var ScanObserver = (function (__super__) {
inherits(ScanObserver, __super__);
function ScanObserver(o, parent) {
this._o = o;
this._p = parent;
Similar blocks of code found in 4 locations. Consider refactoring.
var DefaultScheduler = (function (__super__) {
inherits(DefaultScheduler, __super__);
function DefaultScheduler() {
__super__.call(this);
}
Similar blocks of code found in 3 locations. Consider refactoring.
var ZipObserver = (function (__super__) {
inherits(ZipObserver, __super__);
function ZipObserver(o, i, p, q, d) {
this._o = o;
this._i = i;
Similar blocks of code found in 3 locations. Consider refactoring.
var CombineLatestObserver = (function (__super__) {
inherits(CombineLatestObserver, __super__);
function CombineLatestObserver(o, i, cb, state) {
this._o = o;
this._i = i;
Similar blocks of code found in 4 locations. Consider refactoring.
function baseIsEqualDeep(object, other, equalFunc, isLoose, stackA, stackB) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
Similar blocks of code found in 3 locations. Consider refactoring.
var FilterObservable = (function (__super__) {
inherits(FilterObservable, __super__);
function FilterObservable(source, predicate, thisArg) {
this.source = source;
Similar blocks of code found in 3 locations. Consider refactoring.
var MapObservable = (function (__super__) {
inherits(MapObservable, __super__);
function MapObservable(source, selector, thisArg) {
this.source = source;
Identical blocks of code found in 3 locations. Consider refactoring.
function delayWithSelector(source, subscriptionDelay, delayDurationSelector) {
var subDelay, selector;
if (isFunction(subscriptionDelay)) {
selector = subscriptionDelay;
} else {
Similar blocks of code found in 3 locations. Consider refactoring.
var AutoDetachObserver = (function (__super__) {
inherits(AutoDetachObserver, __super__);
function AutoDetachObserver(observer) {
__super__.call(this);
Similar blocks of code found in 4 locations. Consider refactoring.
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
action(state, innerAction);
src/core/concurrency/scheduler.recursive.js on lines 1..76 Similar blocks of code found in 3 locations. Consider refactoring.
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
src/core/disposables/refcountdisposable.js on lines 4..57 Similar blocks of code found in 3 locations. Consider refactoring.
function debounceWithSelector(source, durationSelector) {
return new AnonymousObservable(function (o) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
var subscription = source.subscribe(
function (x) {
Similar blocks of code found in 3 locations. Consider refactoring.
function timeout(source, dueTime, other, scheduler) {
if (isScheduler(other)) {
scheduler = other;
other = observableThrow(new TimeoutError());
}
Similar blocks of code found in 3 locations. Consider refactoring.
var DistinctUntilChangedObserver = (function(__super__) {
inherits(DistinctUntilChangedObserver, __super__);
function DistinctUntilChangedObserver(o, keyFn, comparer) {
this.o = o;
this.keyFn = keyFn;
src/core/perf/operators/distinctuntilchanged.js on lines 17..52 Similar blocks of code found in 3 locations. Consider refactoring.
var PausableObservable = (function (__super__) {
inherits(PausableObservable, __super__);
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
Similar blocks of code found in 3 locations. Consider refactoring.
var EventPatternObservable = (function(__super__) {
inherits(EventPatternObservable, __super__);
function EventPatternObservable(add, del, fn) {
this._add = add;
this._del = del;
src/core/linq/observable/fromeventpattern.js on lines 1..42 Similar blocks of code found in 3 locations. Consider refactoring.
var noop = Rx.helpers.noop = function () { },
identity = Rx.helpers.identity = function (x) { return x; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
Similar blocks of code found in 3 locations. Consider refactoring.
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
* Creates a new observer in a non-stopped state.
Similar blocks of code found in 3 locations. Consider refactoring.
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (o) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
src/core/backpressure/pausablebuffered.js on lines 1..48 Similar blocks of code found in 4 locations. Consider refactoring.
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
this.source = source;
this._connection = null;
Similar blocks of code found in 3 locations. Consider refactoring.
var IgnoreElementsObservable = (function(__super__) {
inherits(IgnoreElementsObservable, __super__);
function IgnoreElementsObservable(source) {
this.source = source;
src/core/perf/operators/ignoreelements.js on lines 1..42 Similar blocks of code found in 3 locations. Consider refactoring.
var FromPromiseObservable = (function(__super__) {
inherits(FromPromiseObservable, __super__);
function FromPromiseObservable(p, s) {
this._p = p;
this._s = s;
Similar blocks of code found in 3 locations. Consider refactoring.
var WithLatestFromObservable = (function(__super__) {
inherits(WithLatestFromObservable, __super__);
function WithLatestFromObservable(source, sources, resultSelector) {
this._s = source;
this._ss = sources;
src/core/perf/operators/withlatestfrom.js on lines 8..41 Similar blocks of code found in 3 locations. Consider refactoring.
var FromObservable = (function(__super__) {
inherits(FromObservable, __super__);
function FromObservable(iterable, fn, scheduler) {
this._iterable = iterable;
this._fn = fn;
Similar blocks of code found in 5 locations. Consider refactoring.
function equalObjects(object, other, equalFunc, isLoose, stackA, stackB) {
var objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
Similar blocks of code found in 3 locations. Consider refactoring.
var TakeObservable = (function(__super__) {
inherits(TakeObservable, __super__);
function TakeObservable(source, count) {
this.source = source;
this._count = count;
Similar blocks of code found in 3 locations. Consider refactoring.
var ConcatObservable = (function(__super__) {
inherits(ConcatObservable, __super__);
function ConcatObservable(sources) {
this._sources = sources;
__super__.call(this);
Similar blocks of code found in 3 locations. Consider refactoring.
var TakeWhileObserver = (function (__super__) {
inherits(TakeWhileObserver, __super__);
function TakeWhileObserver(o, p) {
this._o = o;
Similar blocks of code found in 4 locations. Consider refactoring.
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
function fixSubscriber(subscriber) {
Similar blocks of code found in 3 locations. Consider refactoring.
var FinallyObservable = (function (__super__) {
inherits(FinallyObservable, __super__);
function FinallyObservable(source, fn, thisArg) {
this.source = source;
this._fn = bindCallback(fn, thisArg, 0);
Similar blocks of code found in 4 locations. Consider refactoring.
var Scheduler = Rx.Scheduler = (function () {
function Scheduler() { }
Similar blocks of code found in 4 locations. Consider refactoring.
var ObservableBase = Rx.ObservableBase = (function (__super__) {
inherits(ObservableBase, __super__);
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
Similar blocks of code found in 3 locations. Consider refactoring.
var SkipObservable = (function(__super__) {
inherits(SkipObservable, __super__);
function SkipObservable(source, count) {
this.source = source;
this._count = count;
Similar blocks of code found in 4 locations. Consider refactoring.
var RefCountObservable = (function (__super__) {
inherits(RefCountObservable, __super__);
function RefCountObservable(source) {
this.source = source;
this._count = 0;
Similar blocks of code found in 3 locations. Consider refactoring.
var SkipWhileObserver = (function (__super__) {
inherits(SkipWhileObserver, __super__);
function SkipWhileObserver(o, p) {
this._o = o;
Similar blocks of code found in 3 locations. Consider refactoring.
var CatchObserver = (function(__super__) {
inherits(CatchObserver, __super__);
function CatchObserver(o, s, fn) {
this._o = o;
this._s = s;
Similar blocks of code found in 3 locations. Consider refactoring.
var WithLatestFromSourceObserver = (function (__super__) {
inherits(WithLatestFromSourceObserver, __super__);
function WithLatestFromSourceObserver(o, cb, state) {
this._o = o;
this._cb = cb;
Similar blocks of code found in 3 locations. Consider refactoring.
var ZipIterableObservable = (function(__super__) {
inherits(ZipIterableObservable, __super__);
function ZipIterableObservable(sources, cb) {
this.sources = sources;
this._cb = cb;
Similar blocks of code found in 3 locations. Consider refactoring.
var OfEnumerable = (function(__super__) {
inherits(OfEnumerable, __super__);
function OfEnumerable(s, fn, thisArg) {
this.s = s;
this.fn = fn ? bindCallback(fn, thisArg, 3) : null;
Similar blocks of code found in 4 locations. Consider refactoring.
var CurrentThreadScheduler = (function (__super__) {
var queue;
function runTrampoline () {
while (queue.length > 0) {
src/core/concurrency/currentthreadscheduler.js on lines 4..38 Similar blocks of code found in 3 locations. Consider refactoring.
var ToArrayObservable = (function(__super__) {
inherits(ToArrayObservable, __super__);
function ToArrayObservable(source) {
this.source = source;
__super__.call(this);
Similar blocks of code found in 3 locations. Consider refactoring.
var CombineLatestObservable = (function(__super__) {
inherits(CombineLatestObservable, __super__);
function CombineLatestObservable(params, cb) {
this._params = params;
this._cb = cb;
src/core/perf/operators/combinelatest.js on lines 8..38 Similar blocks of code found in 4 locations. Consider refactoring.
var Notification = Rx.Notification = (function () {
function Notification() {
}
Similar blocks of code found in 3 locations. Consider refactoring.
var TakeLastObserver = (function (__super__) {
inherits(TakeLastObserver, __super__);
function TakeLastObserver(o, c) {
this._o = o;
this._c = c;
Similar blocks of code found in 3 locations. Consider refactoring.
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function createTick(self) {
return function tick(command, recurse) {
recurse(0, self._period);
var state = tryCatch(self._action)(self._state);
src/core/concurrency/scheduleperiodicrecursive.js on lines 1..30 Similar blocks of code found in 3 locations. Consider refactoring.
var SamplerObserver = (function(__super__) {
inherits(SamplerObserver, __super__);
function SamplerObserver(s) {
this._s = s;
__super__.call(this);
Identical blocks of code found in 3 locations. Consider refactoring.
var observableMerge = Observable.merge = function () {
var scheduler, sources = [], i, len = arguments.length;
if (!arguments[0]) {
scheduler = immediateScheduler;
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
Similar blocks of code found in 3 locations. Consider refactoring.
var ZipObservable = (function(__super__) {
inherits(ZipObservable, __super__);
function ZipObservable(sources, resultSelector) {
this._s = sources;
this._cb = resultSelector;
Identical blocks of code found in 3 locations. Consider refactoring.
function createNodeHandler(o, ctx, selector) {
return function handler () {
var err = arguments[0];
if (err) { return o.onError(err); }
Similar blocks of code found in 3 locations. Consider refactoring.
var SkipLastObserver = (function (__super__) {
inherits(SkipLastObserver, __super__);
function SkipLastObserver(o, c) {
this._o = o;
this._c = c;
Similar blocks of code found in 3 locations. Consider refactoring.
var PairsObservable = (function(__super__) {
inherits(PairsObservable, __super__);
function PairsObservable(o, scheduler) {
this._o = o;
this._keys = Object.keys(o);
Similar blocks of code found in 3 locations. Consider refactoring.
var TransduceObserver = (function (__super__) {
inherits(TransduceObserver, __super__);
function TransduceObserver(o, xform) {
this._o = o;
this._xform = xform;
Similar blocks of code found in 3 locations. Consider refactoring.
var SkipUntilObservable = (function(__super__) {
inherits(SkipUntilObservable, __super__);
function SkipUntilObservable(source, other) {
this._s = source;
Similar blocks of code found in 4 locations. Consider refactoring.
priorityProto.heapify = function (index) {
+index || (index = 0);
if (index >= this.length || index < 0) { return; }
var left = 2 * index + 1,
right = 2 * index + 2,
Similar blocks of code found in 3 locations. Consider refactoring.
var WithLatestFromOtherObserver = (function (__super__) {
inherits(WithLatestFromOtherObserver, __super__);
function WithLatestFromOtherObserver(o, i, state) {
this._o = o;
this._i = i;
Similar blocks of code found in 3 locations. Consider refactoring.
var EventObservable = (function(__super__) {
inherits(EventObservable, __super__);
function EventObservable(el, name, fn) {
this._el = el;
this._n = name;
Similar blocks of code found in 3 locations. Consider refactoring.
var EmptyObservable = (function(__super__) {
inherits(EmptyObservable, __super__);
function EmptyObservable(scheduler) {
this.scheduler = scheduler;
__super__.call(this);
Similar blocks of code found in 3 locations. Consider refactoring.
var RepeatEnumerable = (function (__super__) {
inherits(RepeatEnumerable, __super__);
function RepeatEnumerable(v, c) {
this.v = v;
this.c = c == null ? -1 : c;
Similar blocks of code found in 3 locations. Consider refactoring.
var RangeObservable = (function(__super__) {
inherits(RangeObservable, __super__);
function RangeObservable(start, count, scheduler) {
this.start = start;
this.rangeCount = count;
Identical blocks of code found in 3 locations. Consider refactoring.
function createCbHandler(o, ctx, selector) {
return function handler () {
var len = arguments.length, results = new Array(len);
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
Similar blocks of code found in 3 locations. Consider refactoring.
var MaterializeObserver = (function (__super__) {
inherits(MaterializeObserver, __super__);
function MaterializeObserver(o) {
this._o = o;
Identical blocks of code found in 3 locations. Consider refactoring.
Observable.fromEvent = function (element, eventName, selector, eventListenerOptions) {
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h, eventListenerOptions); },
Similar blocks of code found in 3 locations. Consider refactoring.
var SampleSourceObserver = (function(__super__) {
inherits(SampleSourceObserver, __super__);
function SampleSourceObserver(s) {
this._s = s;
__super__.call(this);
Similar blocks of code found in 3 locations. Consider refactoring.
var SkipUntilOtherObserver = (function(__super__) {
inherits(SkipUntilOtherObserver, __super__);
function SkipUntilOtherObserver(o, p, r) {
this._o = o;
this._p = p;
Similar blocks of code found in 4 locations. Consider refactoring.
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
Similar blocks of code found in 2 locations. Consider refactoring.
var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this._args = args;
this._scheduler = scheduler;
Similar blocks of code found in 3 locations. Consider refactoring.
var SkipUntilSourceObserver = (function(__super__) {
inherits(SkipUntilSourceObserver, __super__);
function SkipUntilSourceObserver(o, p) {
this._o = o;
this._p = p;
Similar blocks of code found in 3 locations. Consider refactoring.
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
Similar blocks of code found in 3 locations. Consider refactoring.
var TimestampObserver = (function (__super__) {
inherits(TimestampObserver, __super__);
function TimestampObserver(o, s) {
this._o = o;
this._s = s;
Similar blocks of code found in 3 locations. Consider refactoring.
observableProto.throttle = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = defaultScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
Similar blocks of code found in 3 locations. Consider refactoring.
var ConcatObserver = (function(__super__) {
inherits(ConcatObserver, __super__);
function ConcatObserver(s, fn) {
this._s = s;
this._fn = fn;
Similar blocks of code found in 3 locations. Consider refactoring.
var JustObservable = (function(__super__) {
inherits(JustObservable, __super__);
function JustObservable(value, scheduler) {
this._value = value;
this._scheduler = scheduler;
Identical blocks of code found in 4 locations. Consider refactoring.
function makeStackTraceLong(error, observable) {
if (hasStacks &&
observable.stack &&
src/core/longstacktraces/longstacktraces.js on lines 3..24 Similar blocks of code found in 3 locations. Consider refactoring.
var ThrowObservable = (function(__super__) {
inherits(ThrowObservable, __super__);
function ThrowObservable(error, scheduler) {
this._error = error;
this._scheduler = scheduler;
Similar blocks of code found in 3 locations. Consider refactoring.
var SampleObservable = (function(__super__) {
inherits(SampleObservable, __super__);
function SampleObservable(source, sampler) {
this.source = source;
this._sampler = sampler;
Similar blocks of code found in 2 locations. Consider refactoring.
observableProto.zip = function () {
if (arguments.length === 0) { throw new Error('invalid arguments'); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
Similar blocks of code found in 3 locations. Consider refactoring.
var ControlledObservable = (function (__super__) {
inherits(ControlledObservable, __super__);
function ControlledObservable (source, enableQueue, scheduler) {
__super__.call(this);
this.subject = new ControlledSubject(enableQueue, scheduler);
Identical blocks of code found in 2 locations. Consider refactoring.
var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {
if (typeof thisArg === 'undefined') { return func; }
switch(argCount) {
case 0:
return function() {
Identical blocks of code found in 3 locations. Consider refactoring.
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var len = this.disposables.length, currentDisposables = new Array(len);
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
Similar blocks of code found in 3 locations. Consider refactoring.
var DematerializeObserver = (function (__super__) {
inherits(DematerializeObserver, __super__);
function DematerializeObserver(o) {
this._o = o;
Identical blocks of code found in 3 locations. Consider refactoring.
Observable.zip = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {
args = isFunction(args[1]) ? args[0].concat(args[1]) : args[0];
Similar blocks of code found in 3 locations. Consider refactoring.
observableProto.withLatestFrom = function () {
if (arguments.length === 0) { throw new Error('invalid arguments'); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
Similar blocks of code found in 3 locations. Consider refactoring.
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = defaultScheduler);
if (periodOrScheduler != null && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
Identical blocks of code found in 4 locations. Consider refactoring.
var CompositeDisposable = Rx.CompositeDisposable = function () {
var args = [], i, len;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
src/core/disposables/compositedisposable.js on lines 5..17 Similar blocks of code found in 3 locations. Consider refactoring.
var DebounceObservable = (function (__super__) {
inherits(DebounceObservable, __super__);
function DebounceObservable(source, dt, s) {
isScheduler(s) || (s = defaultScheduler);
this.source = source;
Similar blocks of code found in 3 locations. Consider refactoring.
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveFuture(0, d, function (count, self) {
if (p > 0) {
src/core/linq/observable/_observabletimerdateandperiod.js on lines 1..14 Similar blocks of code found in 4 locations. Consider refactoring.
var MulticastObservable = (function (__super__) {
inherits(MulticastObservable, __super__);
function MulticastObservable(source, fn1, fn2) {
this.source = source;
this._fn1 = fn1;
Similar blocks of code found in 4 locations. Consider refactoring.
var OnErrorNotification = (function (__super__) {
inherits(OnErrorNotification, __super__);
function OnErrorNotification(error) {
this.error = error;
this.kind = 'E';
Similar blocks of code found in 4 locations. Consider refactoring.
var OnNextNotification = (function (__super__) {
inherits(OnNextNotification, __super__);
function OnNextNotification(value) {
this.value = value;
this.kind = 'N';
Similar blocks of code found in 3 locations. Consider refactoring.
var MergeDelayErrorObservable = (function(__super__) {
inherits(MergeDelayErrorObservable, __super__);
function MergeDelayErrorObservable(source) {
this.source = source;
__super__.call(this);
src/core/linq/observable/mergedelayerror.js on lines 9..28 Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
Similar blocks of code found in 3 locations. Consider refactoring.
var Defer = (function(__super__) {
inherits(Defer, __super__);
function Defer(factory) {
this._f = factory;
__super__.call(this);
Identical blocks of code found in 3 locations. Consider refactoring.
RepeatSink.prototype.run = function () {
var observer = this.observer, value = this.parent.value;
function loopRecursive(i, recurse) {
if (i === -1 || i > 0) {
observer.onNext(value);
Similar blocks of code found in 3 locations. Consider refactoring.
var CatchObservable = (function (__super__) {
inherits(CatchObservable, __super__);
function CatchObservable(source, fn) {
this.source = source;
this._fn = fn;
Identical blocks of code found in 4 locations. Consider refactoring.
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) { return; }
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) { return; }
if (this.isHigherPriority(index, parent)) {
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.zipIterable = function () {
if (arguments.length === 0) { throw new Error('invalid arguments'); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
Similar blocks of code found in 3 locations. Consider refactoring.
observableProto.delay = function () {
var firstArg = arguments[0];
if (typeof firstArg === 'number' || firstArg instanceof Date) {
var dueTime = firstArg, scheduler = arguments[1];
isScheduler(scheduler) || (scheduler = defaultScheduler);
Identical blocks of code found in 4 locations. Consider refactoring.
var addProperties = Rx.internals.addProperties = function (obj) {
for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
for (var idx = 0, ln = sources.length; idx < ln; idx++) {
var source = sources[idx];
for (var prop in source) {
Similar blocks of code found in 2 locations. Consider refactoring.
var combineLatest = Observable.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
Array.isArray(args[0]) && (args = args[0]);
Similar blocks of code found in 3 locations. Consider refactoring.
var TakeUntilObserver = (function(__super__) {
inherits(TakeUntilObserver, __super__);
function TakeUntilObserver(o) {
this._o = o;
__super__.call(this);
Similar blocks of code found in 3 locations. Consider refactoring.
var TimerObservable = (function(__super__) {
inherits(TimerObservable, __super__);
function TimerObservable(dt, s) {
this._dt = dt;
this._s = s;
src/core/linq/observable/_observabletimer.js on lines 1..19 Similar blocks of code found in 3 locations. Consider refactoring.
var TakeUntilObservable = (function(__super__) {
inherits(TakeUntilObservable, __super__);
function TakeUntilObservable(source, other) {
this.source = source;
Similar blocks of code found in 3 locations. Consider refactoring.
var MergeAllObservable = (function (__super__) {
inherits(MergeAllObservable, __super__);
function MergeAllObservable(source) {
this.source = source;
Identical blocks of code found in 3 locations. Consider refactoring.
function getFileNameAndLineNumber(stackLine) {
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
Similar blocks of code found in 3 locations. Consider refactoring.
var RepeatObservable = (function(__super__) {
inherits(RepeatObservable, __super__);
function RepeatObservable(value, repeatCount, scheduler) {
this.value = value;
this.repeatCount = repeatCount == null ? -1 : repeatCount;
Similar blocks of code found in 3 locations. Consider refactoring.
var MergeObservable = (function (__super__) {
inherits(MergeObservable, __super__);
function MergeObservable(source, maxConcurrent) {
this.source = source;
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {
args[0].unshift(this);
src/core/linq/observable/combinelatestproto.js on lines 10..19 Similar blocks of code found in 4 locations. Consider refactoring.
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
src/core/concurrency/defaultscheduler.js on lines 3..21 Identical blocks of code found in 2 locations. Consider refactoring.
var observableCatch = Observable['catch'] = function () {
var items;
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
Identical blocks of code found in 3 locations. Consider refactoring.
Observable.mergeDelayError = function() {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
Similar blocks of code found in 3 locations. Consider refactoring.
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
Similar blocks of code found in 2 locations. Consider refactoring.
(function (schedulerProto) {
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
Identical blocks of code found in 4 locations. Consider refactoring.
function captureLine() {
if (!hasStacks) { return; }
try {
throw new Error();
Identical blocks of code found in 2 locations. Consider refactoring.
var observableConcat = Observable.concat = function () {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
Similar blocks of code found in 4 locations. Consider refactoring.
var OnCompletedNotification = (function (__super__) {
inherits(OnCompletedNotification, __super__);
function OnCompletedNotification() {
this.kind = 'C';
}
Identical blocks of code found in 3 locations. Consider refactoring.
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
Similar blocks of code found in 3 locations. Consider refactoring.
Rx.Pauser = (function (__super__) {
inherits(Pauser, __super__);
function Pauser() {
__super__.call(this);
}
Identical blocks of code found in 4 locations. Consider refactoring.
function filterStackString(stackString) {
var lines = stackString.split('\n'), desiredLines = [];
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
Similar blocks of code found in 2 locations. Consider refactoring.
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
Identical blocks of code found in 2 locations. Consider refactoring.
observableProto.timeout = function () {
var firstArg = arguments[0];
if (firstArg instanceof Date || typeof firstArg === 'number') {
return timeout(this, firstArg, arguments[1], arguments[2]);
} else if (Observable.isObservable(firstArg) || isFunction(firstArg)) {
Identical blocks of code found in 4 locations. Consider refactoring.
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
Identical blocks of code found in 2 locations. Consider refactoring.
NAryDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
for (var i = 0, len = this._disposables.length; i < len; i++) {
this._disposables[i].dispose();
Similar blocks of code found in 6 locations. Consider refactoring.
Observable.fromCallback = function (fn, ctx, selector) {
return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len)
Similar blocks of code found in 6 locations. Consider refactoring.
Observable.fromNodeCallback = function (fn, ctx, selector) {
return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
Similar blocks of code found in 6 locations. Consider refactoring.
var TakeWhileObservable = (function (__super__) {
inherits(TakeWhileObservable, __super__);
function TakeWhileObservable(source, fn) {
this.source = source;
this._fn = fn;
Similar blocks of code found in 3 locations. Consider refactoring.
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
Similar blocks of code found in 6 locations. Consider refactoring.
var SkipWhileObservable = (function (__super__) {
inherits(SkipWhileObservable, __super__);
function SkipWhileObservable(source, fn) {
this.source = source;
this._fn = fn;
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.pluck = function () {
var len = arguments.length, args = new Array(len);
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return this.map(plucker(args, len));
Identical blocks of code found in 3 locations. Consider refactoring.
InnerSubscription.prototype.dispose = function () {
if (!this._s.isDisposed && this._o !== null) {
var idx = this._s.observers.indexOf(this._o);
this._s.observers.splice(idx, 1);
this._o = null;
Identical blocks of code found in 2 locations. Consider refactoring.
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodic(0, period, function (count) {
observer.onNext(count);
Identical blocks of code found in 4 locations. Consider refactoring.
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
src/core/concurrency/scheduleditem.js on lines 1..8 Similar blocks of code found in 3 locations. Consider refactoring.
var MaterializeObservable = (function (__super__) {
inherits(MaterializeObservable, __super__);
function MaterializeObservable(source, fn) {
this.source = source;
__super__.call(this);
Identical blocks of code found in 4 locations. Consider refactoring.
SerialDisposable.prototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
var old = this.current;
this.current = value;
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.concat = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
args.unshift(this);
return observableConcat.apply(null, args);
};
src/core/linq/observable/concatproto.js on lines 5..9 Identical blocks of code found in 3 locations. Consider refactoring.
Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length, args = new Array(len - 1);
for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }
return new FromArrayObservable(args, scheduler);
};
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.debounce = function () {
if (isFunction (arguments[0])) {
return debounceWithSelector(this, arguments[0]);
} else if (typeof arguments[0] === 'number') {
return new DebounceObservable(this, arguments[0], arguments[1]);
Identical blocks of code found in 3 locations. Consider refactoring.
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new FromArrayObservable(args, currentThreadScheduler);
};
Identical blocks of code found in 4 locations. Consider refactoring.
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.map = observableProto.select = function (selector, thisArg) {
var selectorFn = typeof selector === 'function' ? selector : function () { return selector; };
return this instanceof MapObservable ?
this.internalMap(selectorFn, thisArg) :
new MapObservable(this, selectorFn, thisArg);
Similar blocks of code found in 4 locations. Consider refactoring.
var ImmediateScheduler = (function (__super__) {
inherits(ImmediateScheduler, __super__);
function ImmediateScheduler() {
__super__.call(this);
}
src/core/concurrency/immediatescheduler.js on lines 2..13 Identical blocks of code found in 4 locations. Consider refactoring.
SingleAssignmentDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
Identical blocks of code found in 4 locations. Consider refactoring.
SerialDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));
};
Identical blocks of code found in 2 locations. Consider refactoring.
observableProto.controlled = function (enableQueue, scheduler) {
if (enableQueue && isScheduler(enableQueue)) {
scheduler = enableQueue;
enableQueue = true;
Identical blocks of code found in 4 locations. Consider refactoring.
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
this.items[this.length] = undefined;
this.heapify();
};
Identical blocks of code found in 4 locations. Consider refactoring.
function isInternalFrame(stackLine) {
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
if (!fileNameAndLineNumber) {
return false;
}
Identical blocks of code found in 4 locations. Consider refactoring.
var inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
Identical blocks of code found in 3 locations. Consider refactoring.
function transformForObserver(o) {
return {
'@@transducer/init': function() {
return o;
},
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
};
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
};
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.transduce = function(transducer) {
var source = this;
return new AnonymousObservable(function(o) {
var xform = transducer(transformForObserver(o));
return source.subscribe(new TransduceObserver(o, xform));
Similar blocks of code found in 3 locations. Consider refactoring.
var NeverObservable = (function(__super__) {
inherits(NeverObservable, __super__);
function NeverObservable() {
__super__.call(this);
}
Identical blocks of code found in 4 locations. Consider refactoring.
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
Identical blocks of code found in 5 locations. Consider refactoring.
function cloneArray(arr) {
var len = arr.length, a = new Array(len);
for(var i = 0; i < len; i++) { a[i] = arr[i]; }
return a;
}
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
};
Similar blocks of code found in 4 locations. Consider refactoring.
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
Similar blocks of code found in 6 locations. Consider refactoring.
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
Similar blocks of code found in 6 locations. Consider refactoring.
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
Identical blocks of code found in 4 locations. Consider refactoring.
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
Similar blocks of code found in 3 locations. Consider refactoring.
observableProto.sample = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = defaultScheduler);
return typeof intervalOrSampler === 'number' ?
new SampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
new SampleObservable(this, intervalOrSampler);
Identical blocks of code found in 4 locations. Consider refactoring.
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new BinaryDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
Identical blocks of code found in 3 locations. Consider refactoring.
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
if (count === 0) { return observableEmpty(scheduler); }
return new TakeObservable(this, count);
};
Similar blocks of code found in 6 locations. Consider refactoring.
function createNodeObservable(fn, ctx, selector, args) {
var o = new AsyncSubject();
args.push(createNodeHandler(o, ctx, selector));
fn.apply(ctx, args);
src/core/perf/operators/fromcallback.js on lines 1..8 src/core/perf/operators/fromnodecallback.js on lines 1..8 Similar blocks of code found in 6 locations. Consider refactoring.
function createCbObservable(fn, ctx, selector, args) {
var o = new AsyncSubject();
args.push(createCbHandler(o, ctx, selector));
fn.apply(ctx, args);
src/core/perf/operators/fromcallback.js on lines 1..8 src/core/perf/operators/fromnodecallback.js on lines 1..8 Identical blocks of code found in 3 locations. Consider refactoring.
IsDisposedDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
this._s.isDisposed = true;
}
Identical blocks of code found in 3 locations. Consider refactoring.
var TimeoutError = Rx.TimeoutError = function(message) {
this.message = message || 'Timeout has occurred';
this.name = 'TimeoutError';
Error.call(this);
};
Similar blocks of code found in 4 locations. Consider refactoring.
var isObject = Rx.internals.isObject = function(value) {
var type = typeof value;
return !!value && (type === 'object' || type === 'function');
};
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.filter = observableProto.where = function (predicate, thisArg) {
return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :
new FilterObservable(this, predicate, thisArg);
};
Identical blocks of code found in 4 locations. Consider refactoring.
var BinaryDisposable = Rx.BinaryDisposable = function (first, second) {
this._first = first;
this._second = second;
this.isDisposed = false;
};
src/core/disposables/binarydisposable.js on lines 1..5 Similar blocks of code found in 3 locations. Consider refactoring.
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler);
};
Similar blocks of code found in 3 locations. Consider refactoring.
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new JustObservable(value, scheduler);
};
Identical blocks of code found in 3 locations. Consider refactoring.
var CompositeError = Rx.CompositeError = function(errors) {
this.innerErrors = errors;
this.message = 'This contains multiple errors. Check the innerErrors';
Error.call(this);
};
src/core/linq/observable/mergedelayerror.js on lines 1..5 Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.flatMap = observableProto.selectMany = observableProto.mergeMap = function(selector, resultSelector, thisArg) {
return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll();
};
Identical blocks of code found in 10 locations. Consider refactoring.
function repeat(value) {
return {
'@@iterator': function () {
return {
next: function () {
Identical blocks of code found in 10 locations. Consider refactoring.
function repeat(value) {
return {
'@@iterator': function () {
return {
next: function () {
Identical blocks of code found in 4 locations. Consider refactoring.
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
Identical blocks of code found in 4 locations. Consider refactoring.
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
Identical blocks of code found in 4 locations. Consider refactoring.
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
};
Identical blocks of code found in 3 locations. Consider refactoring.
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new EventPatternObservable(addHandler, removeHandler, selector).publish().refCount();
};
src/core/linq/observable/fromeventpattern.js on lines 51..53 Similar blocks of code found in 10 locations. Consider refactoring.
var NotImplementedError = Rx.NotImplementedError = function (message) {
this.message = message || 'This operation is not implemented';
Error.call(this);
};
Similar blocks of code found in 3 locations. Consider refactoring.
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler)
};
Similar blocks of code found in 10 locations. Consider refactoring.
var NotSupportedError = Rx.NotSupportedError = function (message) {
this.message = message || 'This operation is not supported';
Error.call(this);
};
Similar blocks of code found in 3 locations. Consider refactoring.
var observableThrow = Observable['throw'] = function (error, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new ThrowObservable(error, scheduler);
};
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
return isFunction(subjectOrSubjectSelector) ?
new MulticastObservable(this, subjectOrSubjectSelector, selector) :
new ConnectableObservable(this, subjectOrSubjectSelector);
};
Identical blocks of code found in 2 locations. Consider refactoring.
observableProto.merge = function (maxConcurrentOrOther) {
return typeof maxConcurrentOrOther !== 'number' ?
observableMerge(this, maxConcurrentOrOther) :
new MergeObservable(this, maxConcurrentOrOther);
};
Identical blocks of code found in 2 locations. Consider refactoring.
observableProto.skipLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
return new SkipLastObservable(this, count);
};
Identical blocks of code found in 3 locations. Consider refactoring.
var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')();
Identical blocks of code found in 3 locations. Consider refactoring.
ScheduledItem.prototype.invokeCore = function () {
return disposableFixup(this.action(this.scheduler, this.state));
};
Identical blocks of code found in 2 locations. Consider refactoring.
observableProto['catch'] = function (handlerOrSecond) {
return isFunction(handlerOrSecond) ? new CatchObservable(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]);
};
Identical blocks of code found in 3 locations. Consider refactoring.
observableProto.flatMapConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) {
return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(1);
};
src/core/perf/operators/concatmap.js on lines 1..3 Similar blocks of code found in 6 locations. Consider refactoring.
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RepeatObservable(value, repeatCount, scheduler);
};
Identical blocks of code found in 2 locations. Consider refactoring.
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : defaultScheduler);
};
Similar blocks of code found in 6 locations. Consider refactoring.
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RangeObservable(start, count, scheduler);
};
Similar blocks of code found in 2 locations. Consider refactoring.
var observableFromPromise = Observable.fromPromise = function (promise, scheduler) {
scheduler || (scheduler = defaultScheduler);
return new FromPromiseObservable(promise, scheduler);
};
There are no issues that match your filters.