anl 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/bin/an-cli.js +3 -0
- package/lib/_virtual/_cloneBuffer.js +7 -0
- package/lib/_virtual/_commonjsHelpers.js +7 -0
- package/lib/_virtual/_nodeUtil.js +7 -0
- package/lib/_virtual/argument.js +7 -0
- package/lib/_virtual/command.js +7 -0
- package/lib/_virtual/eastasianwidth.js +7 -0
- package/lib/_virtual/error.js +7 -0
- package/lib/_virtual/help.js +7 -0
- package/lib/_virtual/index.js +7 -0
- package/lib/_virtual/index2.js +7 -0
- package/lib/_virtual/index3.js +7 -0
- package/lib/_virtual/isBuffer.js +7 -0
- package/lib/_virtual/lodash.js +7 -0
- package/lib/_virtual/option.js +7 -0
- package/lib/_virtual/signals.js +7 -0
- package/lib/_virtual/suggestSimilar.js +7 -0
- package/lib/node_modules/ansi-escapes/index.js +166 -0
- package/lib/node_modules/ansi-styles/index.js +229 -0
- package/lib/node_modules/cli-cursor/index.js +47 -0
- package/lib/node_modules/cli-width/index.js +59 -0
- package/lib/node_modules/commander/esm.mjs.js +32 -0
- package/lib/node_modules/commander/index.js +49 -0
- package/lib/node_modules/commander/lib/argument.js +157 -0
- package/lib/node_modules/commander/lib/command.js +2208 -0
- package/lib/node_modules/commander/lib/error.js +53 -0
- package/lib/node_modules/commander/lib/help.js +474 -0
- package/lib/node_modules/commander/lib/option.js +336 -0
- package/lib/node_modules/commander/lib/suggestSimilar.js +108 -0
- package/lib/node_modules/eastasianwidth/eastasianwidth.js +321 -0
- package/lib/node_modules/figures/index.js +304 -0
- package/lib/node_modules/inquirer/lib/inquirer.js +109 -0
- package/lib/node_modules/inquirer/lib/objects/choice.js +41 -0
- package/lib/node_modules/inquirer/lib/objects/choices.js +125 -0
- package/lib/node_modules/inquirer/lib/objects/separator.js +43 -0
- package/lib/node_modules/inquirer/lib/prompts/base.js +194 -0
- package/lib/node_modules/inquirer/lib/prompts/checkbox.js +283 -0
- package/lib/node_modules/inquirer/lib/prompts/confirm.js +106 -0
- package/lib/node_modules/inquirer/lib/prompts/editor.js +113 -0
- package/lib/node_modules/inquirer/lib/prompts/expand.js +281 -0
- package/lib/node_modules/inquirer/lib/prompts/input.js +118 -0
- package/lib/node_modules/inquirer/lib/prompts/list.js +218 -0
- package/lib/node_modules/inquirer/lib/prompts/number.js +32 -0
- package/lib/node_modules/inquirer/lib/prompts/password.js +135 -0
- package/lib/node_modules/inquirer/lib/prompts/rawlist.js +236 -0
- package/lib/node_modules/inquirer/lib/ui/baseUI.js +99 -0
- package/lib/node_modules/inquirer/lib/ui/bottom-bar.js +103 -0
- package/lib/node_modules/inquirer/lib/ui/prompt.js +158 -0
- package/lib/node_modules/inquirer/lib/utils/events.js +62 -0
- package/lib/node_modules/inquirer/lib/utils/incrementListIndex.js +23 -0
- package/lib/node_modules/inquirer/lib/utils/paginator.js +87 -0
- package/lib/node_modules/inquirer/lib/utils/readline.js +60 -0
- package/lib/node_modules/inquirer/lib/utils/screen-manager.js +183 -0
- package/lib/node_modules/inquirer/lib/utils/utils.js +31 -0
- package/lib/node_modules/inquirer/node_modules/ansi-regex/index.js +14 -0
- package/lib/node_modules/inquirer/node_modules/strip-ansi/index.js +15 -0
- package/lib/node_modules/is-unicode-supported/index.js +27 -0
- package/lib/node_modules/lodash/_DataView.js +16 -0
- package/lib/node_modules/lodash/_Hash.js +44 -0
- package/lib/node_modules/lodash/_ListCache.js +44 -0
- package/lib/node_modules/lodash/_Map.js +16 -0
- package/lib/node_modules/lodash/_MapCache.js +44 -0
- package/lib/node_modules/lodash/_Promise.js +16 -0
- package/lib/node_modules/lodash/_Set.js +16 -0
- package/lib/node_modules/lodash/_Stack.js +40 -0
- package/lib/node_modules/lodash/_Symbol.js +14 -0
- package/lib/node_modules/lodash/_Uint8Array.js +14 -0
- package/lib/node_modules/lodash/_WeakMap.js +16 -0
- package/lib/node_modules/lodash/_apply.js +28 -0
- package/lib/node_modules/lodash/_arrayEach.js +29 -0
- package/lib/node_modules/lodash/_arrayFilter.js +32 -0
- package/lib/node_modules/lodash/_arrayLikeKeys.js +63 -0
- package/lib/node_modules/lodash/_arrayMap.js +28 -0
- package/lib/node_modules/lodash/_arrayPush.js +27 -0
- package/lib/node_modules/lodash/_assignValue.js +37 -0
- package/lib/node_modules/lodash/_assocIndexOf.js +29 -0
- package/lib/node_modules/lodash/_baseAssign.js +26 -0
- package/lib/node_modules/lodash/_baseAssignIn.js +26 -0
- package/lib/node_modules/lodash/_baseAssignValue.js +33 -0
- package/lib/node_modules/lodash/_baseClone.js +197 -0
- package/lib/node_modules/lodash/_baseCreate.js +38 -0
- package/lib/node_modules/lodash/_baseGet.js +33 -0
- package/lib/node_modules/lodash/_baseGetAllKeys.js +29 -0
- package/lib/node_modules/lodash/_baseGetTag.js +38 -0
- package/lib/node_modules/lodash/_baseIsArguments.js +27 -0
- package/lib/node_modules/lodash/_baseIsMap.js +27 -0
- package/lib/node_modules/lodash/_baseIsNative.js +58 -0
- package/lib/node_modules/lodash/_baseIsSet.js +27 -0
- package/lib/node_modules/lodash/_baseIsTypedArray.js +70 -0
- package/lib/node_modules/lodash/_baseKeys.js +39 -0
- package/lib/node_modules/lodash/_baseKeysIn.js +43 -0
- package/lib/node_modules/lodash/_baseRest.js +27 -0
- package/lib/node_modules/lodash/_baseSet.js +63 -0
- package/lib/node_modules/lodash/_baseSetToString.js +32 -0
- package/lib/node_modules/lodash/_baseTimes.js +27 -0
- package/lib/node_modules/lodash/_baseToString.js +48 -0
- package/lib/node_modules/lodash/_baseUnary.js +21 -0
- package/lib/node_modules/lodash/_castPath.js +32 -0
- package/lib/node_modules/lodash/_cloneArrayBuffer.js +24 -0
- package/lib/node_modules/lodash/_cloneBuffer.js +42 -0
- package/lib/node_modules/lodash/_cloneDataView.js +24 -0
- package/lib/node_modules/lodash/_cloneRegExp.js +24 -0
- package/lib/node_modules/lodash/_cloneSymbol.js +26 -0
- package/lib/node_modules/lodash/_cloneTypedArray.js +24 -0
- package/lib/node_modules/lodash/_copyArray.js +27 -0
- package/lib/node_modules/lodash/_copyObject.js +49 -0
- package/lib/node_modules/lodash/_copySymbols.js +25 -0
- package/lib/node_modules/lodash/_copySymbolsIn.js +25 -0
- package/lib/node_modules/lodash/_coreJsData.js +14 -0
- package/lib/node_modules/lodash/_defineProperty.js +19 -0
- package/lib/node_modules/lodash/_freeGlobal.js +13 -0
- package/lib/node_modules/lodash/_getAllKeys.js +26 -0
- package/lib/node_modules/lodash/_getAllKeysIn.js +27 -0
- package/lib/node_modules/lodash/_getMapData.js +26 -0
- package/lib/node_modules/lodash/_getNative.js +26 -0
- package/lib/node_modules/lodash/_getPrototype.js +14 -0
- package/lib/node_modules/lodash/_getRawTag.js +54 -0
- package/lib/node_modules/lodash/_getSymbols.js +39 -0
- package/lib/node_modules/lodash/_getSymbolsIn.js +36 -0
- package/lib/node_modules/lodash/_getTag.js +72 -0
- package/lib/node_modules/lodash/_getValue.js +20 -0
- package/lib/node_modules/lodash/_hashClear.js +23 -0
- package/lib/node_modules/lodash/_hashDelete.js +24 -0
- package/lib/node_modules/lodash/_hashGet.js +38 -0
- package/lib/node_modules/lodash/_hashHas.js +31 -0
- package/lib/node_modules/lodash/_hashSet.js +31 -0
- package/lib/node_modules/lodash/_initCloneArray.js +33 -0
- package/lib/node_modules/lodash/_initCloneByTag.js +89 -0
- package/lib/node_modules/lodash/_initCloneObject.js +28 -0
- package/lib/node_modules/lodash/_isIndex.js +32 -0
- package/lib/node_modules/lodash/_isIterateeCall.js +41 -0
- package/lib/node_modules/lodash/_isKey.js +38 -0
- package/lib/node_modules/lodash/_isKeyable.js +22 -0
- package/lib/node_modules/lodash/_isMasked.js +28 -0
- package/lib/node_modules/lodash/_isPrototype.js +25 -0
- package/lib/node_modules/lodash/_listCacheClear.js +20 -0
- package/lib/node_modules/lodash/_listCacheDelete.js +43 -0
- package/lib/node_modules/lodash/_listCacheGet.js +27 -0
- package/lib/node_modules/lodash/_listCacheHas.js +24 -0
- package/lib/node_modules/lodash/_listCacheSet.js +34 -0
- package/lib/node_modules/lodash/_mapCacheClear.js +31 -0
- package/lib/node_modules/lodash/_mapCacheDelete.js +26 -0
- package/lib/node_modules/lodash/_mapCacheGet.js +24 -0
- package/lib/node_modules/lodash/_mapCacheHas.js +24 -0
- package/lib/node_modules/lodash/_mapCacheSet.js +30 -0
- package/lib/node_modules/lodash/_memoizeCapped.js +34 -0
- package/lib/node_modules/lodash/_nativeCreate.js +14 -0
- package/lib/node_modules/lodash/_nativeKeys.js +14 -0
- package/lib/node_modules/lodash/_nativeKeysIn.js +27 -0
- package/lib/node_modules/lodash/_nodeUtil.js +37 -0
- package/lib/node_modules/lodash/_objectToString.js +29 -0
- package/lib/node_modules/lodash/_overArg.js +22 -0
- package/lib/node_modules/lodash/_overRest.js +44 -0
- package/lib/node_modules/lodash/_root.js +17 -0
- package/lib/node_modules/lodash/_setToString.js +23 -0
- package/lib/node_modules/lodash/_shortOut.js +44 -0
- package/lib/node_modules/lodash/_stackClear.js +23 -0
- package/lib/node_modules/lodash/_stackDelete.js +25 -0
- package/lib/node_modules/lodash/_stackGet.js +21 -0
- package/lib/node_modules/lodash/_stackHas.js +21 -0
- package/lib/node_modules/lodash/_stackSet.js +44 -0
- package/lib/node_modules/lodash/_stringToPath.js +35 -0
- package/lib/node_modules/lodash/_toKey.js +29 -0
- package/lib/node_modules/lodash/_toSource.js +33 -0
- package/lib/node_modules/lodash/clone.js +44 -0
- package/lib/node_modules/lodash/constant.js +33 -0
- package/lib/node_modules/lodash/defaults.js +75 -0
- package/lib/node_modules/lodash/eq.js +44 -0
- package/lib/node_modules/lodash/get.js +41 -0
- package/lib/node_modules/lodash/identity.js +28 -0
- package/lib/node_modules/lodash/isArguments.js +45 -0
- package/lib/node_modules/lodash/isArray.js +33 -0
- package/lib/node_modules/lodash/isArrayLike.js +42 -0
- package/lib/node_modules/lodash/isBuffer.js +46 -0
- package/lib/node_modules/lodash/isFunction.js +46 -0
- package/lib/node_modules/lodash/isLength.js +42 -0
- package/lib/node_modules/lodash/isMap.js +38 -0
- package/lib/node_modules/lodash/isObject.js +38 -0
- package/lib/node_modules/lodash/isObjectLike.js +36 -0
- package/lib/node_modules/lodash/isPlainObject.js +72 -0
- package/lib/node_modules/lodash/isSet.js +38 -0
- package/lib/node_modules/lodash/isSymbol.js +38 -0
- package/lib/node_modules/lodash/isTypedArray.js +38 -0
- package/lib/node_modules/lodash/keys.js +47 -0
- package/lib/node_modules/lodash/keysIn.js +42 -0
- package/lib/node_modules/lodash/lodash.js +17209 -0
- package/lib/node_modules/lodash/memoize.js +81 -0
- package/lib/node_modules/lodash/set.js +43 -0
- package/lib/node_modules/lodash/stubArray.js +30 -0
- package/lib/node_modules/lodash/stubFalse.js +25 -0
- package/lib/node_modules/lodash/toString.js +36 -0
- package/lib/node_modules/mute-stream/mute.js +157 -0
- package/lib/node_modules/restore-cursor/index.js +20 -0
- package/lib/node_modules/run-async/index.js +106 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/Observable.js +107 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/Subject.js +167 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/Subscriber.js +174 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/Subscription.js +150 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/config.js +13 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/ConnectableObservable.js +68 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/defer.js +14 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/empty.js +16 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/from.js +12 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js +65 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/fromSubscribable.js +11 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js +155 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/observable/of.js +17 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +67 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/concatMap.js +12 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/connect.js +23 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/filter.js +15 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/flatMap.js +9 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/map.js +17 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/mergeInternals.js +67 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js +22 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/multicast.js +19 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +16 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/publish.js +13 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/reduce.js +12 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/refCount.js +32 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/scanInternals.js +28 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/share.js +91 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js +14 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/take.js +26 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/operators/takeUntil.js +17 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleArray.js +24 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleAsyncIterable.js +29 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleIterable.js +38 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleObservable.js +13 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduled/schedulePromise.js +13 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleReadableStreamLike.js +12 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduled/scheduled.js +43 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +21 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js +14 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +7 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js +15 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +18 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/args.js +14 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +12 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +16 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +11 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +23 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/identity.js +9 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js +7 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js +11 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +9 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js +12 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isIterable.js +12 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isPromise.js +11 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js +45 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/isScheduler.js +11 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/lift.js +27 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/mapOneOrManyArgs.js +16 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/noop.js +7 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/pipe.js +19 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +15 -0
- package/lib/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js +9 -0
- package/lib/node_modules/signal-exit/index.js +222 -0
- package/lib/node_modules/signal-exit/signals.js +59 -0
- package/lib/node_modules/string-width/index.js +64 -0
- package/lib/node_modules/string-width/node_modules/ansi-regex/index.js +14 -0
- package/lib/node_modules/string-width/node_modules/strip-ansi/index.js +15 -0
- package/lib/node_modules/tslib/tslib.es6.js +145 -0
- package/lib/node_modules/wrap-ansi/index.js +220 -0
- package/lib/node_modules/wrap-ansi/node_modules/ansi-regex/index.js +14 -0
- package/lib/node_modules/wrap-ansi/node_modules/strip-ansi/index.js +15 -0
- package/lib/package.json.js +94 -0
- package/lib/src/index.js +12 -0
- package/lib/src/install-eslint.js +32 -0
- package/lib/src/lint-init.js +31 -0
- package/lib/src/utils.js +37 -0
- package/package.json +62 -0
- package/template/.eslintignore +3 -0
- package/template/.eslintrc.js +22 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Observable = require('../Observable.js');
|
|
6
|
+
|
|
7
|
+
function fromSubscribable(subscribable) {
|
|
8
|
+
return new Observable.Observable(function (subscriber) { return subscribable.subscribe(subscriber); });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.fromSubscribable = fromSubscribable;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../tslib/tslib.es6.js');
|
|
6
|
+
var isArrayLike = require('../util/isArrayLike.js');
|
|
7
|
+
var isPromise = require('../util/isPromise.js');
|
|
8
|
+
var Observable = require('../Observable.js');
|
|
9
|
+
var isInteropObservable = require('../util/isInteropObservable.js');
|
|
10
|
+
var isAsyncIterable = require('../util/isAsyncIterable.js');
|
|
11
|
+
var throwUnobservableError = require('../util/throwUnobservableError.js');
|
|
12
|
+
var isIterable = require('../util/isIterable.js');
|
|
13
|
+
var isReadableStreamLike = require('../util/isReadableStreamLike.js');
|
|
14
|
+
var isFunction = require('../util/isFunction.js');
|
|
15
|
+
var reportUnhandledError = require('../util/reportUnhandledError.js');
|
|
16
|
+
var observable = require('../symbol/observable.js');
|
|
17
|
+
|
|
18
|
+
function innerFrom(input) {
|
|
19
|
+
if (input instanceof Observable.Observable) {
|
|
20
|
+
return input;
|
|
21
|
+
}
|
|
22
|
+
if (input != null) {
|
|
23
|
+
if (isInteropObservable.isInteropObservable(input)) {
|
|
24
|
+
return fromInteropObservable(input);
|
|
25
|
+
}
|
|
26
|
+
if (isArrayLike.isArrayLike(input)) {
|
|
27
|
+
return fromArrayLike(input);
|
|
28
|
+
}
|
|
29
|
+
if (isPromise.isPromise(input)) {
|
|
30
|
+
return fromPromise(input);
|
|
31
|
+
}
|
|
32
|
+
if (isAsyncIterable.isAsyncIterable(input)) {
|
|
33
|
+
return fromAsyncIterable(input);
|
|
34
|
+
}
|
|
35
|
+
if (isIterable.isIterable(input)) {
|
|
36
|
+
return fromIterable(input);
|
|
37
|
+
}
|
|
38
|
+
if (isReadableStreamLike.isReadableStreamLike(input)) {
|
|
39
|
+
return fromReadableStreamLike(input);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
throw throwUnobservableError.createInvalidObservableTypeError(input);
|
|
43
|
+
}
|
|
44
|
+
function fromInteropObservable(obj) {
|
|
45
|
+
return new Observable.Observable(function (subscriber) {
|
|
46
|
+
var obs = obj[observable.observable]();
|
|
47
|
+
if (isFunction.isFunction(obs.subscribe)) {
|
|
48
|
+
return obs.subscribe(subscriber);
|
|
49
|
+
}
|
|
50
|
+
throw new TypeError('Provided object does not correctly implement Symbol.observable');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function fromArrayLike(array) {
|
|
54
|
+
return new Observable.Observable(function (subscriber) {
|
|
55
|
+
for (var i = 0; i < array.length && !subscriber.closed; i++) {
|
|
56
|
+
subscriber.next(array[i]);
|
|
57
|
+
}
|
|
58
|
+
subscriber.complete();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function fromPromise(promise) {
|
|
62
|
+
return new Observable.Observable(function (subscriber) {
|
|
63
|
+
promise
|
|
64
|
+
.then(function (value) {
|
|
65
|
+
if (!subscriber.closed) {
|
|
66
|
+
subscriber.next(value);
|
|
67
|
+
subscriber.complete();
|
|
68
|
+
}
|
|
69
|
+
}, function (err) { return subscriber.error(err); })
|
|
70
|
+
.then(null, reportUnhandledError.reportUnhandledError);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function fromIterable(iterable) {
|
|
74
|
+
return new Observable.Observable(function (subscriber) {
|
|
75
|
+
var e_1, _a;
|
|
76
|
+
try {
|
|
77
|
+
for (var iterable_1 = tslib_es6.__values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
78
|
+
var value = iterable_1_1.value;
|
|
79
|
+
subscriber.next(value);
|
|
80
|
+
if (subscriber.closed) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
86
|
+
finally {
|
|
87
|
+
try {
|
|
88
|
+
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) _a.call(iterable_1);
|
|
89
|
+
}
|
|
90
|
+
finally { if (e_1) throw e_1.error; }
|
|
91
|
+
}
|
|
92
|
+
subscriber.complete();
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function fromAsyncIterable(asyncIterable) {
|
|
96
|
+
return new Observable.Observable(function (subscriber) {
|
|
97
|
+
process(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function fromReadableStreamLike(readableStream) {
|
|
101
|
+
return fromAsyncIterable(isReadableStreamLike.readableStreamLikeToAsyncGenerator(readableStream));
|
|
102
|
+
}
|
|
103
|
+
function process(asyncIterable, subscriber) {
|
|
104
|
+
var asyncIterable_1, asyncIterable_1_1;
|
|
105
|
+
var e_2, _a;
|
|
106
|
+
return tslib_es6.__awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var value, e_2_1;
|
|
108
|
+
return tslib_es6.__generator(this, function (_b) {
|
|
109
|
+
switch (_b.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
_b.trys.push([0, 5, 6, 11]);
|
|
112
|
+
asyncIterable_1 = tslib_es6.__asyncValues(asyncIterable);
|
|
113
|
+
_b.label = 1;
|
|
114
|
+
case 1: return [4, asyncIterable_1.next()];
|
|
115
|
+
case 2:
|
|
116
|
+
if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done)) return [3, 4];
|
|
117
|
+
value = asyncIterable_1_1.value;
|
|
118
|
+
subscriber.next(value);
|
|
119
|
+
if (subscriber.closed) {
|
|
120
|
+
return [2];
|
|
121
|
+
}
|
|
122
|
+
_b.label = 3;
|
|
123
|
+
case 3: return [3, 1];
|
|
124
|
+
case 4: return [3, 11];
|
|
125
|
+
case 5:
|
|
126
|
+
e_2_1 = _b.sent();
|
|
127
|
+
e_2 = { error: e_2_1 };
|
|
128
|
+
return [3, 11];
|
|
129
|
+
case 6:
|
|
130
|
+
_b.trys.push([6, , 9, 10]);
|
|
131
|
+
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return))) return [3, 8];
|
|
132
|
+
return [4, _a.call(asyncIterable_1)];
|
|
133
|
+
case 7:
|
|
134
|
+
_b.sent();
|
|
135
|
+
_b.label = 8;
|
|
136
|
+
case 8: return [3, 10];
|
|
137
|
+
case 9:
|
|
138
|
+
if (e_2) throw e_2.error;
|
|
139
|
+
return [7];
|
|
140
|
+
case 10: return [7];
|
|
141
|
+
case 11:
|
|
142
|
+
subscriber.complete();
|
|
143
|
+
return [2];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
exports.fromArrayLike = fromArrayLike;
|
|
150
|
+
exports.fromAsyncIterable = fromAsyncIterable;
|
|
151
|
+
exports.fromInteropObservable = fromInteropObservable;
|
|
152
|
+
exports.fromIterable = fromIterable;
|
|
153
|
+
exports.fromPromise = fromPromise;
|
|
154
|
+
exports.fromReadableStreamLike = fromReadableStreamLike;
|
|
155
|
+
exports.innerFrom = innerFrom;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var args = require('../util/args.js');
|
|
6
|
+
var from = require('./from.js');
|
|
7
|
+
|
|
8
|
+
function of() {
|
|
9
|
+
var args$1 = [];
|
|
10
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
|
+
args$1[_i] = arguments[_i];
|
|
12
|
+
}
|
|
13
|
+
var scheduler = args.popScheduler(args$1);
|
|
14
|
+
return from.from(args$1, scheduler);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.of = of;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../tslib/tslib.es6.js');
|
|
6
|
+
var Subscriber = require('../Subscriber.js');
|
|
7
|
+
|
|
8
|
+
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
9
|
+
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
10
|
+
}
|
|
11
|
+
var OperatorSubscriber = (function (_super) {
|
|
12
|
+
tslib_es6.__extends(OperatorSubscriber, _super);
|
|
13
|
+
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
14
|
+
var _this = _super.call(this, destination) || this;
|
|
15
|
+
_this.onFinalize = onFinalize;
|
|
16
|
+
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
17
|
+
_this._next = onNext
|
|
18
|
+
? function (value) {
|
|
19
|
+
try {
|
|
20
|
+
onNext(value);
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
destination.error(err);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
: _super.prototype._next;
|
|
27
|
+
_this._error = onError
|
|
28
|
+
? function (err) {
|
|
29
|
+
try {
|
|
30
|
+
onError(err);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
destination.error(err);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
this.unsubscribe();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
: _super.prototype._error;
|
|
40
|
+
_this._complete = onComplete
|
|
41
|
+
? function () {
|
|
42
|
+
try {
|
|
43
|
+
onComplete();
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
destination.error(err);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
this.unsubscribe();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
: _super.prototype._complete;
|
|
53
|
+
return _this;
|
|
54
|
+
}
|
|
55
|
+
OperatorSubscriber.prototype.unsubscribe = function () {
|
|
56
|
+
var _a;
|
|
57
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
58
|
+
var closed_1 = this.closed;
|
|
59
|
+
_super.prototype.unsubscribe.call(this);
|
|
60
|
+
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return OperatorSubscriber;
|
|
64
|
+
}(Subscriber.Subscriber));
|
|
65
|
+
|
|
66
|
+
exports.OperatorSubscriber = OperatorSubscriber;
|
|
67
|
+
exports.createOperatorSubscriber = createOperatorSubscriber;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var mergeMap = require('./mergeMap.js');
|
|
6
|
+
var isFunction = require('../util/isFunction.js');
|
|
7
|
+
|
|
8
|
+
function concatMap(project, resultSelector) {
|
|
9
|
+
return isFunction.isFunction(resultSelector) ? mergeMap.mergeMap(project, resultSelector, 1) : mergeMap.mergeMap(project, 1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.concatMap = concatMap;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Subject = require('../Subject.js');
|
|
6
|
+
var innerFrom = require('../observable/innerFrom.js');
|
|
7
|
+
var lift = require('../util/lift.js');
|
|
8
|
+
var fromSubscribable = require('../observable/fromSubscribable.js');
|
|
9
|
+
|
|
10
|
+
var DEFAULT_CONFIG = {
|
|
11
|
+
connector: function () { return new Subject.Subject(); },
|
|
12
|
+
};
|
|
13
|
+
function connect(selector, config) {
|
|
14
|
+
if (config === void 0) { config = DEFAULT_CONFIG; }
|
|
15
|
+
var connector = config.connector;
|
|
16
|
+
return lift.operate(function (source, subscriber) {
|
|
17
|
+
var subject = connector();
|
|
18
|
+
innerFrom.innerFrom(selector(fromSubscribable.fromSubscribable(subject))).subscribe(subscriber);
|
|
19
|
+
subscriber.add(source.subscribe(subject));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.connect = connect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var lift = require('../util/lift.js');
|
|
6
|
+
var OperatorSubscriber = require('./OperatorSubscriber.js');
|
|
7
|
+
|
|
8
|
+
function filter(predicate, thisArg) {
|
|
9
|
+
return lift.operate(function (source, subscriber) {
|
|
10
|
+
var index = 0;
|
|
11
|
+
source.subscribe(OperatorSubscriber.createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.filter = filter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var lift = require('../util/lift.js');
|
|
6
|
+
var OperatorSubscriber = require('./OperatorSubscriber.js');
|
|
7
|
+
|
|
8
|
+
function map(project, thisArg) {
|
|
9
|
+
return lift.operate(function (source, subscriber) {
|
|
10
|
+
var index = 0;
|
|
11
|
+
source.subscribe(OperatorSubscriber.createOperatorSubscriber(subscriber, function (value) {
|
|
12
|
+
subscriber.next(project.call(thisArg, value, index++));
|
|
13
|
+
}));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.map = map;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var innerFrom = require('../observable/innerFrom.js');
|
|
6
|
+
var executeSchedule = require('../util/executeSchedule.js');
|
|
7
|
+
var OperatorSubscriber = require('./OperatorSubscriber.js');
|
|
8
|
+
|
|
9
|
+
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
10
|
+
var buffer = [];
|
|
11
|
+
var active = 0;
|
|
12
|
+
var index = 0;
|
|
13
|
+
var isComplete = false;
|
|
14
|
+
var checkComplete = function () {
|
|
15
|
+
if (isComplete && !buffer.length && !active) {
|
|
16
|
+
subscriber.complete();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var outerNext = function (value) { return (active < concurrent ? doInnerSub(value) : buffer.push(value)); };
|
|
20
|
+
var doInnerSub = function (value) {
|
|
21
|
+
expand && subscriber.next(value);
|
|
22
|
+
active++;
|
|
23
|
+
var innerComplete = false;
|
|
24
|
+
innerFrom.innerFrom(project(value, index++)).subscribe(OperatorSubscriber.createOperatorSubscriber(subscriber, function (innerValue) {
|
|
25
|
+
onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
|
|
26
|
+
if (expand) {
|
|
27
|
+
outerNext(innerValue);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
subscriber.next(innerValue);
|
|
31
|
+
}
|
|
32
|
+
}, function () {
|
|
33
|
+
innerComplete = true;
|
|
34
|
+
}, undefined, function () {
|
|
35
|
+
if (innerComplete) {
|
|
36
|
+
try {
|
|
37
|
+
active--;
|
|
38
|
+
var _loop_1 = function () {
|
|
39
|
+
var bufferedValue = buffer.shift();
|
|
40
|
+
if (innerSubScheduler) {
|
|
41
|
+
executeSchedule.executeSchedule(subscriber, innerSubScheduler, function () { return doInnerSub(bufferedValue); });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
doInnerSub(bufferedValue);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
while (buffer.length && active < concurrent) {
|
|
48
|
+
_loop_1();
|
|
49
|
+
}
|
|
50
|
+
checkComplete();
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
subscriber.error(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
source.subscribe(OperatorSubscriber.createOperatorSubscriber(subscriber, outerNext, function () {
|
|
59
|
+
isComplete = true;
|
|
60
|
+
checkComplete();
|
|
61
|
+
}));
|
|
62
|
+
return function () {
|
|
63
|
+
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.mergeInternals = mergeInternals;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var map = require('./map.js');
|
|
6
|
+
var innerFrom = require('../observable/innerFrom.js');
|
|
7
|
+
var lift = require('../util/lift.js');
|
|
8
|
+
var mergeInternals = require('./mergeInternals.js');
|
|
9
|
+
var isFunction = require('../util/isFunction.js');
|
|
10
|
+
|
|
11
|
+
function mergeMap(project, resultSelector, concurrent) {
|
|
12
|
+
if (concurrent === void 0) { concurrent = Infinity; }
|
|
13
|
+
if (isFunction.isFunction(resultSelector)) {
|
|
14
|
+
return mergeMap(function (a, i) { return map.map(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom.innerFrom(project(a, i))); }, concurrent);
|
|
15
|
+
}
|
|
16
|
+
else if (typeof resultSelector === 'number') {
|
|
17
|
+
concurrent = resultSelector;
|
|
18
|
+
}
|
|
19
|
+
return lift.operate(function (source, subscriber) { return mergeInternals.mergeInternals(source, subscriber, project, concurrent); });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.mergeMap = mergeMap;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ConnectableObservable = require('../observable/ConnectableObservable.js');
|
|
6
|
+
var isFunction = require('../util/isFunction.js');
|
|
7
|
+
var connect = require('./connect.js');
|
|
8
|
+
|
|
9
|
+
function multicast(subjectOrSubjectFactory, selector) {
|
|
10
|
+
var subjectFactory = isFunction.isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : function () { return subjectOrSubjectFactory; };
|
|
11
|
+
if (isFunction.isFunction(selector)) {
|
|
12
|
+
return connect.connect(selector, {
|
|
13
|
+
connector: subjectFactory,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return function (source) { return new ConnectableObservable.ConnectableObservable(source, subjectFactory); };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.multicast = multicast;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var executeSchedule = require('../util/executeSchedule.js');
|
|
6
|
+
var lift = require('../util/lift.js');
|
|
7
|
+
var OperatorSubscriber = require('./OperatorSubscriber.js');
|
|
8
|
+
|
|
9
|
+
function observeOn(scheduler, delay) {
|
|
10
|
+
if (delay === void 0) { delay = 0; }
|
|
11
|
+
return lift.operate(function (source, subscriber) {
|
|
12
|
+
source.subscribe(OperatorSubscriber.createOperatorSubscriber(subscriber, function (value) { return executeSchedule.executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule.executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule.executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.observeOn = observeOn;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Subject = require('../Subject.js');
|
|
6
|
+
var multicast = require('./multicast.js');
|
|
7
|
+
var connect = require('./connect.js');
|
|
8
|
+
|
|
9
|
+
function publish(selector) {
|
|
10
|
+
return selector ? function (source) { return connect.connect(selector)(source); } : function (source) { return multicast.multicast(new Subject.Subject())(source); };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.publish = publish;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var scanInternals = require('./scanInternals.js');
|
|
6
|
+
var lift = require('../util/lift.js');
|
|
7
|
+
|
|
8
|
+
function reduce(accumulator, seed) {
|
|
9
|
+
return lift.operate(scanInternals.scanInternals(accumulator, seed, arguments.length >= 2, false, true));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.reduce = reduce;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var lift = require('../util/lift.js');
|
|
6
|
+
var OperatorSubscriber = require('./OperatorSubscriber.js');
|
|
7
|
+
|
|
8
|
+
function refCount() {
|
|
9
|
+
return lift.operate(function (source, subscriber) {
|
|
10
|
+
var connection = null;
|
|
11
|
+
source._refCount++;
|
|
12
|
+
var refCounter = OperatorSubscriber.createOperatorSubscriber(subscriber, undefined, undefined, undefined, function () {
|
|
13
|
+
if (!source || source._refCount <= 0 || 0 < --source._refCount) {
|
|
14
|
+
connection = null;
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var sharedConnection = source._connection;
|
|
18
|
+
var conn = connection;
|
|
19
|
+
connection = null;
|
|
20
|
+
if (sharedConnection && (!conn || sharedConnection === conn)) {
|
|
21
|
+
sharedConnection.unsubscribe();
|
|
22
|
+
}
|
|
23
|
+
subscriber.unsubscribe();
|
|
24
|
+
});
|
|
25
|
+
source.subscribe(refCounter);
|
|
26
|
+
if (!refCounter.closed) {
|
|
27
|
+
connection = source.connect();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.refCount = refCount;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var OperatorSubscriber = require('./OperatorSubscriber.js');
|
|
6
|
+
|
|
7
|
+
function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
|
|
8
|
+
return function (source, subscriber) {
|
|
9
|
+
var hasState = hasSeed;
|
|
10
|
+
var state = seed;
|
|
11
|
+
var index = 0;
|
|
12
|
+
source.subscribe(OperatorSubscriber.createOperatorSubscriber(subscriber, function (value) {
|
|
13
|
+
var i = index++;
|
|
14
|
+
state = hasState
|
|
15
|
+
?
|
|
16
|
+
accumulator(state, value, i)
|
|
17
|
+
:
|
|
18
|
+
((hasState = true), value);
|
|
19
|
+
emitOnNext && subscriber.next(state);
|
|
20
|
+
}, emitBeforeComplete &&
|
|
21
|
+
(function () {
|
|
22
|
+
hasState && subscriber.next(state);
|
|
23
|
+
subscriber.complete();
|
|
24
|
+
})));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.scanInternals = scanInternals;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../../../../../tslib/tslib.es6.js');
|
|
6
|
+
var innerFrom = require('../observable/innerFrom.js');
|
|
7
|
+
var Subject = require('../Subject.js');
|
|
8
|
+
var Subscriber = require('../Subscriber.js');
|
|
9
|
+
var lift = require('../util/lift.js');
|
|
10
|
+
|
|
11
|
+
function share(options) {
|
|
12
|
+
if (options === void 0) { options = {}; }
|
|
13
|
+
var _a = options.connector, connector = _a === void 0 ? function () { return new Subject.Subject(); } : _a, _b = options.resetOnError, resetOnError = _b === void 0 ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === void 0 ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === void 0 ? true : _d;
|
|
14
|
+
return function (wrapperSource) {
|
|
15
|
+
var connection;
|
|
16
|
+
var resetConnection;
|
|
17
|
+
var subject;
|
|
18
|
+
var refCount = 0;
|
|
19
|
+
var hasCompleted = false;
|
|
20
|
+
var hasErrored = false;
|
|
21
|
+
var cancelReset = function () {
|
|
22
|
+
resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
|
|
23
|
+
resetConnection = undefined;
|
|
24
|
+
};
|
|
25
|
+
var reset = function () {
|
|
26
|
+
cancelReset();
|
|
27
|
+
connection = subject = undefined;
|
|
28
|
+
hasCompleted = hasErrored = false;
|
|
29
|
+
};
|
|
30
|
+
var resetAndUnsubscribe = function () {
|
|
31
|
+
var conn = connection;
|
|
32
|
+
reset();
|
|
33
|
+
conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
|
|
34
|
+
};
|
|
35
|
+
return lift.operate(function (source, subscriber) {
|
|
36
|
+
refCount++;
|
|
37
|
+
if (!hasErrored && !hasCompleted) {
|
|
38
|
+
cancelReset();
|
|
39
|
+
}
|
|
40
|
+
var dest = (subject = subject !== null && subject !== void 0 ? subject : connector());
|
|
41
|
+
subscriber.add(function () {
|
|
42
|
+
refCount--;
|
|
43
|
+
if (refCount === 0 && !hasErrored && !hasCompleted) {
|
|
44
|
+
resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
dest.subscribe(subscriber);
|
|
48
|
+
if (!connection &&
|
|
49
|
+
refCount > 0) {
|
|
50
|
+
connection = new Subscriber.SafeSubscriber({
|
|
51
|
+
next: function (value) { return dest.next(value); },
|
|
52
|
+
error: function (err) {
|
|
53
|
+
hasErrored = true;
|
|
54
|
+
cancelReset();
|
|
55
|
+
resetConnection = handleReset(reset, resetOnError, err);
|
|
56
|
+
dest.error(err);
|
|
57
|
+
},
|
|
58
|
+
complete: function () {
|
|
59
|
+
hasCompleted = true;
|
|
60
|
+
cancelReset();
|
|
61
|
+
resetConnection = handleReset(reset, resetOnComplete);
|
|
62
|
+
dest.complete();
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
innerFrom.innerFrom(source).subscribe(connection);
|
|
66
|
+
}
|
|
67
|
+
})(wrapperSource);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function handleReset(reset, on) {
|
|
71
|
+
var args = [];
|
|
72
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
73
|
+
args[_i - 2] = arguments[_i];
|
|
74
|
+
}
|
|
75
|
+
if (on === true) {
|
|
76
|
+
reset();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (on === false) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
var onSubscriber = new Subscriber.SafeSubscriber({
|
|
83
|
+
next: function () {
|
|
84
|
+
onSubscriber.unsubscribe();
|
|
85
|
+
reset();
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
return innerFrom.innerFrom(on.apply(void 0, tslib_es6.__spreadArray([], tslib_es6.__read(args)))).subscribe(onSubscriber);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.share = share;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var lift = require('../util/lift.js');
|
|
6
|
+
|
|
7
|
+
function subscribeOn(scheduler, delay) {
|
|
8
|
+
if (delay === void 0) { delay = 0; }
|
|
9
|
+
return lift.operate(function (source, subscriber) {
|
|
10
|
+
subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.subscribeOn = subscribeOn;
|