new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
export function levenshtein(a, b) {
|
||||
if (a.length === 0)
|
||||
return b.length;
|
||||
if (b.length === 0)
|
||||
return a.length;
|
||||
const matrix = [];
|
||||
let i;
|
||||
for (i = 0; i <= b.length; i++) {
|
||||
matrix[i] = [i];
|
||||
}
|
||||
let j;
|
||||
for (j = 0; j <= a.length; j++) {
|
||||
matrix[0][j] = j;
|
||||
}
|
||||
for (i = 1; i <= b.length; i++) {
|
||||
for (j = 1; j <= a.length; j++) {
|
||||
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1];
|
||||
}
|
||||
else {
|
||||
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
return matrix[b.length][a.length];
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Explorer.d.ts","sourceRoot":"","sources":["../src/Explorer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAEhF,cAAM,QAAS,SAAQ,YAAY,CAAC,eAAe,CAAC;gBAC/B,OAAO,EAAE,eAAe;IAI9B,MAAM,CACjB,UAAU,GAAE,MAAsB,GACjC,OAAO,CAAC,iBAAiB,CAAC;YAOf,mBAAmB;YAuBnB,eAAe;YAaf,eAAe;YAYf,eAAe;YAef,uBAAuB;IAUxB,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAyBhE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
export declare function is_head(node: any): boolean;
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/zip';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H"},C:{"1":"PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB DC EC"},D:{"1":"RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB"},E:{"1":"A B C K L H 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G GC zB HC IC JC KC"},F:{"1":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w x y z AB BB CB DB OC PC QC RC qB 9B SC rB"},G:{"1":"aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:1,C:"Passive event listeners"};
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/BoundNodeCallbackObservable';
|
||||
@@ -0,0 +1,100 @@
|
||||
import { Subscription } from '../Subscription';
|
||||
import { subscribeToResult } from '../util/subscribeToResult';
|
||||
import { OuterSubscriber } from '../OuterSubscriber';
|
||||
export function bufferToggle(openings, closingSelector) {
|
||||
return function bufferToggleOperatorFunction(source) {
|
||||
return source.lift(new BufferToggleOperator(openings, closingSelector));
|
||||
};
|
||||
}
|
||||
class BufferToggleOperator {
|
||||
constructor(openings, closingSelector) {
|
||||
this.openings = openings;
|
||||
this.closingSelector = closingSelector;
|
||||
}
|
||||
call(subscriber, source) {
|
||||
return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector));
|
||||
}
|
||||
}
|
||||
class BufferToggleSubscriber extends OuterSubscriber {
|
||||
constructor(destination, openings, closingSelector) {
|
||||
super(destination);
|
||||
this.closingSelector = closingSelector;
|
||||
this.contexts = [];
|
||||
this.add(subscribeToResult(this, openings));
|
||||
}
|
||||
_next(value) {
|
||||
const contexts = this.contexts;
|
||||
const len = contexts.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
contexts[i].buffer.push(value);
|
||||
}
|
||||
}
|
||||
_error(err) {
|
||||
const contexts = this.contexts;
|
||||
while (contexts.length > 0) {
|
||||
const context = contexts.shift();
|
||||
context.subscription.unsubscribe();
|
||||
context.buffer = null;
|
||||
context.subscription = null;
|
||||
}
|
||||
this.contexts = null;
|
||||
super._error(err);
|
||||
}
|
||||
_complete() {
|
||||
const contexts = this.contexts;
|
||||
while (contexts.length > 0) {
|
||||
const context = contexts.shift();
|
||||
this.destination.next(context.buffer);
|
||||
context.subscription.unsubscribe();
|
||||
context.buffer = null;
|
||||
context.subscription = null;
|
||||
}
|
||||
this.contexts = null;
|
||||
super._complete();
|
||||
}
|
||||
notifyNext(outerValue, innerValue) {
|
||||
outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue);
|
||||
}
|
||||
notifyComplete(innerSub) {
|
||||
this.closeBuffer(innerSub.context);
|
||||
}
|
||||
openBuffer(value) {
|
||||
try {
|
||||
const closingSelector = this.closingSelector;
|
||||
const closingNotifier = closingSelector.call(this, value);
|
||||
if (closingNotifier) {
|
||||
this.trySubscribe(closingNotifier);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this._error(err);
|
||||
}
|
||||
}
|
||||
closeBuffer(context) {
|
||||
const contexts = this.contexts;
|
||||
if (contexts && context) {
|
||||
const { buffer, subscription } = context;
|
||||
this.destination.next(buffer);
|
||||
contexts.splice(contexts.indexOf(context), 1);
|
||||
this.remove(subscription);
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
trySubscribe(closingNotifier) {
|
||||
const contexts = this.contexts;
|
||||
const buffer = [];
|
||||
const subscription = new Subscription();
|
||||
const context = { buffer, subscription };
|
||||
contexts.push(context);
|
||||
const innerSubscription = subscribeToResult(this, closingNotifier, context);
|
||||
if (!innerSubscription || innerSubscription.closed) {
|
||||
this.closeBuffer(context);
|
||||
}
|
||||
else {
|
||||
innerSubscription.context = context;
|
||||
this.add(innerSubscription);
|
||||
subscription.add(innerSubscription);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=bufferToggle.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"audit.js","sources":["../src/operator/audit.ts"],"names":[],"mappings":";;;;;AAAA,gDAA2C"}
|
||||
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("rxjs-compat/add/operator/timeout");
|
||||
//# sourceMappingURL=timeout.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sampleTime.js","sources":["../../src/add/operator/sampleTime.ts"],"names":[],"mappings":";;AAAA,+CAA6C"}
|
||||
@@ -0,0 +1 @@
|
||||
import 'rxjs-compat/add/operator/mergeMapTo';
|
||||
@@ -0,0 +1,57 @@
|
||||
import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
|
||||
export function distinct(keySelector, flushes) {
|
||||
return (source) => source.lift(new DistinctOperator(keySelector, flushes));
|
||||
}
|
||||
class DistinctOperator {
|
||||
constructor(keySelector, flushes) {
|
||||
this.keySelector = keySelector;
|
||||
this.flushes = flushes;
|
||||
}
|
||||
call(subscriber, source) {
|
||||
return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes));
|
||||
}
|
||||
}
|
||||
export class DistinctSubscriber extends SimpleOuterSubscriber {
|
||||
constructor(destination, keySelector, flushes) {
|
||||
super(destination);
|
||||
this.keySelector = keySelector;
|
||||
this.values = new Set();
|
||||
if (flushes) {
|
||||
this.add(innerSubscribe(flushes, new SimpleInnerSubscriber(this)));
|
||||
}
|
||||
}
|
||||
notifyNext() {
|
||||
this.values.clear();
|
||||
}
|
||||
notifyError(error) {
|
||||
this._error(error);
|
||||
}
|
||||
_next(value) {
|
||||
if (this.keySelector) {
|
||||
this._useKeySelector(value);
|
||||
}
|
||||
else {
|
||||
this._finalizeNext(value, value);
|
||||
}
|
||||
}
|
||||
_useKeySelector(value) {
|
||||
let key;
|
||||
const { destination } = this;
|
||||
try {
|
||||
key = this.keySelector(value);
|
||||
}
|
||||
catch (err) {
|
||||
destination.error(err);
|
||||
return;
|
||||
}
|
||||
this._finalizeNext(key, value);
|
||||
}
|
||||
_finalizeNext(key, value) {
|
||||
const { values } = this;
|
||||
if (!values.has(key)) {
|
||||
values.add(key);
|
||||
this.destination.next(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=distinct.js.map
|
||||
@@ -0,0 +1,5 @@
|
||||
import { isArray } from './isArray';
|
||||
export function isNumeric(val) {
|
||||
return !isArray(val) && (val - parseFloat(val) + 1) >= 0;
|
||||
}
|
||||
//# sourceMappingURL=isNumeric.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
import './ambient';
|
||||
export { onMount, onDestroy, beforeUpdate, afterUpdate, setContext, getContext, hasContext, tick, createEventDispatcher, SvelteComponentDev as SvelteComponent, SvelteComponentTyped } from 'svelte/internal';
|
||||
@@ -0,0 +1,92 @@
|
||||
export default class Rows {
|
||||
rawRows;
|
||||
triggerChange;
|
||||
sorted;
|
||||
constructor(context) {
|
||||
this.rawRows = context.rawRows;
|
||||
this.triggerChange = context.triggerChange;
|
||||
this.sorted = context.sorted;
|
||||
}
|
||||
sort(orderBy) {
|
||||
if (!orderBy)
|
||||
return;
|
||||
const sorted = this.getSorted();
|
||||
const parsed = this.parse(orderBy);
|
||||
if (sorted.identifier !== parsed.identifier) {
|
||||
this.sorted.update(store => store.direction = null);
|
||||
}
|
||||
if (sorted.direction === null || sorted.direction === 'desc') {
|
||||
this.sortAsc(orderBy);
|
||||
}
|
||||
else if (sorted.direction === 'asc') {
|
||||
this.sortDesc(orderBy);
|
||||
}
|
||||
}
|
||||
sortAsc(orderBy) {
|
||||
const parsed = this.parse(orderBy);
|
||||
this.sorted.set({ identifier: parsed.identifier, direction: 'asc' });
|
||||
this.rawRows.update(store => {
|
||||
try {
|
||||
store.sort((a, b) => {
|
||||
if (typeof (parsed.fn(b)) === "boolean") {
|
||||
return parsed.fn(a) ? -1 : 1;
|
||||
}
|
||||
else if (!parsed.fn(b))
|
||||
return 1;
|
||||
else if (!parsed.fn(a))
|
||||
return -1;
|
||||
else {
|
||||
return parsed.fn(a).localeCompare(parsed.fn(b));
|
||||
}
|
||||
});
|
||||
return store;
|
||||
}
|
||||
catch (e) {
|
||||
return store.sort((a, b) => parseFloat(parsed.fn(a)) - parseFloat(parsed.fn(b)));
|
||||
}
|
||||
});
|
||||
this.triggerChange.update(store => { return store + 1; });
|
||||
}
|
||||
sortDesc(orderBy) {
|
||||
const parsed = this.parse(orderBy);
|
||||
this.sorted.set({ identifier: parsed.identifier, direction: 'desc' });
|
||||
this.rawRows.update(store => {
|
||||
try {
|
||||
store.sort((a, b) => {
|
||||
if (typeof (parsed.fn(b)) === "boolean") {
|
||||
return parsed.fn(a) ? 1 : -1;
|
||||
}
|
||||
else if (!parsed.fn(a))
|
||||
return 1;
|
||||
else if (!parsed.fn(b))
|
||||
return -1;
|
||||
else {
|
||||
return parsed.fn(b).localeCompare(parsed.fn(a));
|
||||
}
|
||||
});
|
||||
return store;
|
||||
}
|
||||
catch (e) {
|
||||
return store.sort((a, b) => parseFloat(parsed.fn(b)) - parseFloat(parsed.fn(a)));
|
||||
}
|
||||
});
|
||||
this.triggerChange.update(store => { return store + 1; });
|
||||
}
|
||||
parse(orderBy) {
|
||||
if (typeof (orderBy) === 'string') {
|
||||
return {
|
||||
fn: (row) => row[orderBy],
|
||||
identifier: orderBy.toString()
|
||||
};
|
||||
}
|
||||
return {
|
||||
fn: orderBy,
|
||||
identifier: orderBy.toString()
|
||||
};
|
||||
}
|
||||
getSorted() {
|
||||
let $sorted = { identifier: null, direction: null };
|
||||
this.sorted.subscribe(store => $sorted = store);
|
||||
return $sorted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bufferToggle.js","sources":["../../../src/internal/operators/bufferToggle.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAkDrD,MAAM,UAAU,YAAY,CAC1B,QAAkC,EAClC,eAAyD;IAEzD,OAAO,SAAS,4BAA4B,CAAC,MAAqB;QAChE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAO,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC;AACJ,CAAC;AAED;IAEE,8BAAoB,QAAkC,EAClC,eAAyD;QADzD,aAAQ,GAAR,QAAQ,CAA0B;QAClC,oBAAe,GAAf,eAAe,CAA0C;IAC7E,CAAC;IAED,mCAAI,GAAJ,UAAK,UAA2B,EAAE,MAAW;QAC3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iB,EAAE,CAAC,CAAC,CAAC;aAC5C;SACF;IACH,CAAC;IAtMa,kBAAK,GAAiB,CAAC,UAAS,KAAU;QACtD,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC;IAoMzB,mBAAC;CAAA,AAzMD,IAyMC;AAzMY,oCAAY;AA2MzB,SAAS,2BAA2B,CAAC,MAAa;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC,UAAC,IAAI,EAAE,GAAG,IAAK,OAAA,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,yCAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAApE,CAAoE,EAAE,EAAE,CAAC,CAAC;AAC/G,CAAC"}
|
||||
@@ -0,0 +1,101 @@
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Observable } from '../Observable';
|
||||
import { MonoTypeOperatorFunction, TeardownLogic, ObservableInput } from '../types';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
|
||||
|
||||
/**
|
||||
* Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.
|
||||
*
|
||||
* The `skipUntil` operator causes the observable stream to skip the emission of values until the passed in observable emits the first value.
|
||||
* This can be particularly useful in combination with user interactions, responses of http requests or waiting for specific times to pass by.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Internally the `skipUntil` operator subscribes to the passed in observable (in the following called *notifier*) in order to recognize the emission
|
||||
* of its first value. When this happens, the operator unsubscribes from the *notifier* and starts emitting the values of the *source*
|
||||
* observable. It will never let the *source* observable emit any values if the *notifier* completes or throws an error without emitting
|
||||
* a value before.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* In the following example, all emitted values of the interval observable are skipped until the user clicks anywhere within the page.
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, fromEvent } from 'rxjs';
|
||||
* import { skipUntil } from 'rxjs/operators';
|
||||
*
|
||||
* const intervalObservable = interval(1000);
|
||||
* const click = fromEvent(document, 'click');
|
||||
*
|
||||
* const emitAfterClick = intervalObservable.pipe(
|
||||
* skipUntil(click)
|
||||
* );
|
||||
* // clicked at 4.6s. output: 5...6...7...8........ or
|
||||
* // clicked at 7.3s. output: 8...9...10..11.......
|
||||
* const subscribe = emitAfterClick.subscribe(value => console.log(value));
|
||||
* ```
|
||||
*
|
||||
* @param {Observable} notifier - The second Observable that has to emit an item before the source Observable's elements begin to
|
||||
* be mirrored by the resulting Observable.
|
||||
* @return {Observable<T>} An Observable that skips items from the source Observable until the second Observable emits
|
||||
* an item, then emits the remaining items.
|
||||
* @method skipUntil
|
||||
* @owner Observable
|
||||
*/
|
||||
export function skipUntil<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T> {
|
||||
return (source: Observable<T>) => source.lift(new SkipUntilOperator(notifier));
|
||||
}
|
||||
|
||||
class SkipUntilOperator<T> implements Operator<T, T> {
|
||||
constructor(private notifier: Observable<any>) {
|
||||
}
|
||||
|
||||
call(destination: Subscriber<T>, source: any): TeardownLogic {
|
||||
return source.subscribe(new SkipUntilSubscriber(destination, this.notifier));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class SkipUntilSubscriber<T, R> extends SimpleOuterSubscriber<T, R> {
|
||||
|
||||
private hasValue: boolean = false;
|
||||
private innerSubscription?: Subscription;
|
||||
|
||||
constructor(destination: Subscriber<R>, notifier: ObservableInput<any>) {
|
||||
super(destination);
|
||||
const innerSubscriber = new SimpleInnerSubscriber(this);
|
||||
this.add(innerSubscriber);
|
||||
this.innerSubscription = innerSubscriber;
|
||||
const innerSubscription = innerSubscribe(notifier, innerSubscriber);
|
||||
// The returned subscription will usually be the subscriber that was
|
||||
// passed. However, interop subscribers will be wrapped and for
|
||||
// unsubscriptions to chain correctly, the wrapper needs to be added, too.
|
||||
if (innerSubscription !== innerSubscriber) {
|
||||
this.add(innerSubscription);
|
||||
this.innerSubscription = innerSubscription;
|
||||
}
|
||||
}
|
||||
|
||||
protected _next(value: T) {
|
||||
if (this.hasValue) {
|
||||
super._next(value);
|
||||
}
|
||||
}
|
||||
|
||||
notifyNext(): void {
|
||||
this.hasValue = true;
|
||||
if (this.innerSubscription) {
|
||||
this.innerSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
notifyComplete() {
|
||||
/* do nothing */
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import {PromiseValue} from './promise-value';
|
||||
import {SetReturnType} from './set-return-type';
|
||||
|
||||
/**
|
||||
Create an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types.
|
||||
|
||||
Use-case: You have two functions, one synchronous and one asynchronous that do the same thing. Instead of having to duplicate the type definition, you can use `Asyncify` to reuse the synchronous type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Asyncify} from 'type-fest';
|
||||
|
||||
// Synchronous function.
|
||||
function getFooSync(someArg: SomeType): Foo {
|
||||
// …
|
||||
}
|
||||
|
||||
type AsyncifiedFooGetter = Asyncify<typeof getFooSync>;
|
||||
//=> type AsyncifiedFooGetter = (someArg: SomeType) => Promise<Foo>;
|
||||
|
||||
// Same as `getFooSync` but asynchronous.
|
||||
const getFooAsync: AsyncifiedFooGetter = (someArg) => {
|
||||
// TypeScript now knows that `someArg` is `SomeType` automatically.
|
||||
// It also knows that this function must return `Promise<Foo>`.
|
||||
// If you have `@typescript-eslint/promise-function-async` linter rule enabled, it will even report that "Functions that return promises must be async.".
|
||||
|
||||
// …
|
||||
}
|
||||
```
|
||||
*/
|
||||
export type Asyncify<Fn extends (...args: any[]) => any> = SetReturnType<Fn, Promise<PromiseValue<ReturnType<Fn>>>>;
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { ObservableInput } from '../types';
|
||||
|
||||
/**
|
||||
* Tests to see if the object is an RxJS {@link Observable}
|
||||
* @param obj the object to test
|
||||
*/
|
||||
export function isObservable<T>(obj: any): obj is Observable<T> {
|
||||
return !!obj && (obj instanceof Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));
|
||||
}
|
||||
Reference in New Issue
Block a user