@naturalcycles/js-lib 14.70.2 → 14.74.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/dist/error/try.d.ts +1 -1
- package/dist/error/try.js +2 -0
- package/dist/index.d.ts +28 -26
- package/dist/index.js +28 -122
- package/dist/math/math.util.d.ts +4 -0
- package/dist/math/math.util.js +18 -1
- package/dist/math/sma.d.ts +2 -2
- package/dist/math/stack.util.d.ts +50 -0
- package/dist/math/stack.util.js +87 -0
- package/dist/number/number.util.d.ts +1 -1
- package/dist/number/number.util.js +1 -1
- package/dist/promise/pBatch.d.ts +2 -3
- package/dist/promise/pFilter.d.ts +2 -2
- package/dist/promise/pMap.d.ts +2 -3
- package/dist/promise/pMap.js +13 -7
- package/dist/promise/pProps.d.ts +3 -1
- package/dist/promise/pProps.js +4 -5
- package/dist/seq/seq.d.ts +30 -0
- package/dist/seq/seq.js +141 -0
- package/dist/typeFest.d.ts +0 -30
- package/dist/types.d.ts +13 -1
- package/dist/types.js +9 -1
- package/dist-esm/error/try.js +2 -0
- package/dist-esm/index.js +26 -24
- package/dist-esm/math/math.util.js +16 -0
- package/dist-esm/math/stack.util.js +82 -0
- package/dist-esm/number/number.util.js +1 -1
- package/dist-esm/promise/pMap.js +14 -8
- package/dist-esm/promise/pProps.js +4 -5
- package/dist-esm/seq/seq.js +136 -0
- package/dist-esm/types.js +8 -0
- package/package.json +1 -1
- package/src/error/try.ts +4 -1
- package/src/index.ts +36 -195
- package/src/math/math.util.ts +21 -0
- package/src/math/sma.ts +1 -1
- package/src/math/stack.util.ts +94 -0
- package/src/number/number.util.ts +1 -1
- package/src/promise/pBatch.ts +2 -3
- package/src/promise/pFilter.ts +2 -2
- package/src/promise/pMap.ts +16 -11
- package/src/promise/pProps.ts +6 -7
- package/src/seq/seq.ts +143 -0
- package/src/typeFest.ts +0 -32
- package/src/types.ts +22 -1
package/dist/error/try.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export declare function _try<ERR = unknown, RETURN = void>(fn: () => RETURN): [e
|
|
|
21
21
|
* Also, intentionally types second return item as non-optional,
|
|
22
22
|
* but you should check for `err` presense first!
|
|
23
23
|
*/
|
|
24
|
-
export declare function pTry<ERR = unknown, RETURN = void>(promise: Promise<RETURN>): Promise<[err: ERR | null, value: RETURN]>;
|
|
24
|
+
export declare function pTry<ERR = unknown, RETURN = void>(promise: Promise<RETURN>): Promise<[err: ERR | null, value: Awaited<RETURN>]>;
|
package/dist/error/try.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export * from './array/array.util';
|
|
2
|
+
export * from './lazy';
|
|
3
|
+
export * from './string/url.util';
|
|
4
|
+
export * from './array/range';
|
|
5
5
|
import { PromiseDecoratorCfg, PromiseDecoratorResp, _createPromiseDecorator } from './decorators/createPromiseDecorator';
|
|
6
6
|
import { _debounce, _throttle } from './decorators/debounce';
|
|
7
7
|
import { _Debounce, _Throttle } from './decorators/debounce.decorator';
|
|
@@ -25,37 +25,39 @@ import { JSON_SCHEMA_ORDER } from './json-schema/jsonSchema.cnst';
|
|
|
25
25
|
import { JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaConst, JsonSchemaEnum, JsonSchemaNot, JsonSchemaNull, JsonSchemaNumber, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaOneOf, JsonSchemaRef, JsonSchemaString, JsonSchemaTuple } from './json-schema/jsonSchema.model';
|
|
26
26
|
import { mergeJsonSchemaObjects } from './json-schema/jsonSchema.util';
|
|
27
27
|
import { jsonSchema, JsonSchemaAnyBuilder, JsonSchemaBuilder } from './json-schema/jsonSchemaBuilder';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
export * from './math/math.util';
|
|
29
|
+
export * from './math/sma';
|
|
30
|
+
export * from './number/createDeterministicRandom';
|
|
31
|
+
export * from './number/number.util';
|
|
32
|
+
export * from './object/deepEquals';
|
|
33
|
+
export * from './object/object.util';
|
|
34
|
+
export * from './object/sortObject';
|
|
35
|
+
export * from './object/sortObjectDeep';
|
|
36
36
|
import { AggregatedError } from './promise/AggregatedError';
|
|
37
|
-
|
|
37
|
+
export * from './promise/pBatch';
|
|
38
38
|
import { DeferredPromise, pDefer } from './promise/pDefer';
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
export * from './promise/pDelay';
|
|
40
|
+
export * from './promise/pFilter';
|
|
41
|
+
export * from './promise/pHang';
|
|
42
42
|
import { pMap, PMapOptions } from './promise/pMap';
|
|
43
|
-
|
|
43
|
+
export * from './promise/pProps';
|
|
44
44
|
import { pRetry, PRetryOptions } from './promise/pRetry';
|
|
45
|
-
|
|
45
|
+
export * from './promise/pState';
|
|
46
46
|
import { pTimeout, PTimeoutOptions } from './promise/pTimeout';
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
export * from './promise/pTuple';
|
|
48
|
+
export * from './string/case';
|
|
49
|
+
export * from './string/json.util';
|
|
50
|
+
export * from './string/string.util';
|
|
51
51
|
import { JsonStringifyFunction, StringifyAnyOptions, _stringifyAny } from './string/stringifyAny';
|
|
52
52
|
import { _ms, _since } from './time/time.util';
|
|
53
|
-
import { Class, ConditionalExcept, ConditionalPick, Merge, Promisable,
|
|
54
|
-
import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, BatchResult, InstanceId, IsoDate, IsoDateTime, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestamp, ValueOf, ValuesOf, _noop, _objectKeys, _passNothingPredicate, _passthroughMapper, _passthroughPredicate, _passUndefinedMapper, _stringMapEntries, _stringMapValues } from './types';
|
|
53
|
+
import { Class, ConditionalExcept, ConditionalPick, Merge, Promisable, ReadonlyDeep, Simplify } from './typeFest';
|
|
54
|
+
import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, BatchResult, InstanceId, IsoDate, IsoDateTime, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestamp, ValueOf, ValuesOf, AbortableMapper, AbortableAsyncPredicate, AbortableAsyncMapper, AbortablePredicate, END, SKIP, _noop, _objectKeys, _passNothingPredicate, _passthroughMapper, _passthroughPredicate, _passUndefinedMapper, _stringMapEntries, _stringMapValues } from './types';
|
|
55
55
|
import { _gb, _hb, _kb, _mb } from './unit/size.util';
|
|
56
56
|
import { is } from './vendor/is';
|
|
57
57
|
import { CommonLogLevel, CommonLogFunction, CommonLogger, commonLoggerMinLevel, commonLoggerNoop, commonLogLevelNumber, commonLoggerPipe, commonLoggerPrefix, CommonLogWithLevelFunction, commonLoggerCreate } from './log/commonLogger';
|
|
58
58
|
import { _safeJsonStringify } from './string/safeJsonStringify';
|
|
59
59
|
import { PQueue, PQueueCfg } from './promise/pQueue';
|
|
60
|
-
export
|
|
61
|
-
export
|
|
60
|
+
export * from './seq/seq';
|
|
61
|
+
export * from './math/stack.util';
|
|
62
|
+
export type { AbortableMapper, AbortablePredicate, AbortableAsyncPredicate, AbortableAsyncMapper, PQueueCfg, MemoCache, PromiseDecoratorCfg, PromiseDecoratorResp, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, Admin401ErrorData, Admin403ErrorData, StringMap, PromiseMap, AnyObject, AnyFunction, ValuesOf, ValueOf, KeyValueTuple, ObjectMapper, ObjectPredicate, InstanceId, IsoDate, IsoDateTime, Reviver, PMapOptions, Mapper, AsyncMapper, Predicate, AsyncPredicate, BatchResult, DeferredPromise, PRetryOptions, PTimeoutOptions, TryCatchOptions, StringifyAnyOptions, JsonStringifyFunction, Merge, ReadonlyDeep, Promisable, Simplify, ConditionalPick, ConditionalExcept, Class, UnixTimestamp, BaseDBEntity, SavedDBEntity, Saved, Unsaved, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, JsonSchema, JsonSchemaAny, JsonSchemaOneOf, JsonSchemaAllOf, JsonSchemaAnyOf, JsonSchemaNot, JsonSchemaRef, JsonSchemaConst, JsonSchemaEnum, JsonSchemaString, JsonSchemaNumber, JsonSchemaBoolean, JsonSchemaNull, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaArray, JsonSchemaTuple, JsonSchemaBuilder, CommonLogLevel, CommonLogWithLevelFunction, CommonLogFunction, CommonLogger, };
|
|
63
|
+
export { is, _Memo, _memoFn, _LogMethod, _getArgsSignature, _createPromiseDecorator, AppError, HttpError, AssertionError, _assert, _assertEquals, _assertDeepEquals, _assertIsError, _assertIsString, _assertIsNumber, _assertTypeOf, _stringMapValues, _stringMapEntries, _objectKeys, _debounce, _throttle, _Debounce, _Throttle, pMap, _passthroughMapper, _passUndefinedMapper, _passthroughPredicate, _passNothingPredicate, _noop, ErrorMode, pDefer, AggregatedError, pRetry, pTimeout, _Retry, _Timeout, _tryCatch, _TryCatch, _try, pTry, _stringifyAny, _ms, _since, _hb, _gb, _mb, _kb, mergeJsonSchemaObjects, jsonSchema, JsonSchemaAnyBuilder, JSON_SCHEMA_ORDER, generateJsonSchemaFromData, commonLoggerMinLevel, commonLoggerNoop, commonLogLevelNumber, commonLoggerPipe, commonLoggerPrefix, commonLoggerCreate, _safeJsonStringify, PQueue, END, SKIP, };
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.commonLoggerNoop = exports.commonLoggerMinLevel = exports._lazyValue = exports._defineLazyProps = exports._defineLazyProperty = exports._parseQueryString = exports.generateJsonSchemaFromData = exports.JSON_SCHEMA_ORDER = exports.JsonSchemaAnyBuilder = exports.jsonSchema = exports.mergeJsonSchemaObjects = exports._last = exports._clamp = exports._sumBy = exports._sum = exports._kebabCase = exports._camelCase = exports._snakeCase = exports._kb = exports._mb = exports._gb = exports._hb = exports._since = exports._ms = exports._stringifyAny = exports._jsonParseIfPossible = exports.pTry = exports._try = exports._TryCatch = exports._tryCatch = exports._Timeout = exports._Retry = exports.pTuple = exports.pTimeout = exports.pRetry = exports.AggregatedError = exports.pState = exports.pHang = exports.pDefer = exports.pDelay = exports.pProps = exports.pFilter = exports.ErrorMode = exports.pBatch = exports._noop = exports._passNothingPredicate = exports._passthroughPredicate = exports._passUndefinedMapper = exports._passthroughMapper = exports.pMap = void 0;
|
|
6
|
-
exports.PQueue = exports._safeJsonStringify = exports.commonLoggerCreate = exports.commonLoggerPrefix = exports.commonLoggerPipe = exports.commonLogLevelNumber = void 0;
|
|
3
|
+
exports.JsonSchemaAnyBuilder = exports.jsonSchema = exports.mergeJsonSchemaObjects = exports._kb = exports._mb = exports._gb = exports._hb = exports._since = exports._ms = exports._stringifyAny = exports.pTry = exports._try = exports._TryCatch = exports._tryCatch = exports._Timeout = exports._Retry = exports.pTimeout = exports.pRetry = exports.AggregatedError = exports.pDefer = exports.ErrorMode = exports._noop = exports._passNothingPredicate = exports._passthroughPredicate = exports._passUndefinedMapper = exports._passthroughMapper = exports.pMap = exports._Throttle = exports._Debounce = exports._throttle = exports._debounce = exports._objectKeys = exports._stringMapEntries = exports._stringMapValues = exports._assertTypeOf = exports._assertIsNumber = exports._assertIsString = exports._assertIsError = exports._assertDeepEquals = exports._assertEquals = exports._assert = exports.AssertionError = exports.HttpError = exports.AppError = exports._createPromiseDecorator = exports._getArgsSignature = exports._LogMethod = exports._memoFn = exports._Memo = exports.is = void 0;
|
|
4
|
+
exports.SKIP = exports.END = exports.PQueue = exports._safeJsonStringify = exports.commonLoggerCreate = exports.commonLoggerPrefix = exports.commonLoggerPipe = exports.commonLogLevelNumber = exports.commonLoggerNoop = exports.commonLoggerMinLevel = exports.generateJsonSchemaFromData = exports.JSON_SCHEMA_ORDER = void 0;
|
|
7
5
|
const tslib_1 = require("tslib");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports, "_difference", { enumerable: true, get: function () { return array_util_1._difference; } });
|
|
13
|
-
Object.defineProperty(exports, "_dropRightWhile", { enumerable: true, get: function () { return array_util_1._dropRightWhile; } });
|
|
14
|
-
Object.defineProperty(exports, "_dropWhile", { enumerable: true, get: function () { return array_util_1._dropWhile; } });
|
|
15
|
-
Object.defineProperty(exports, "_findLast", { enumerable: true, get: function () { return array_util_1._findLast; } });
|
|
16
|
-
Object.defineProperty(exports, "_flatten", { enumerable: true, get: function () { return array_util_1._flatten; } });
|
|
17
|
-
Object.defineProperty(exports, "_flattenDeep", { enumerable: true, get: function () { return array_util_1._flattenDeep; } });
|
|
18
|
-
Object.defineProperty(exports, "_groupBy", { enumerable: true, get: function () { return array_util_1._groupBy; } });
|
|
19
|
-
Object.defineProperty(exports, "_intersection", { enumerable: true, get: function () { return array_util_1._intersection; } });
|
|
20
|
-
Object.defineProperty(exports, "_last", { enumerable: true, get: function () { return array_util_1._last; } });
|
|
21
|
-
Object.defineProperty(exports, "_mapToObject", { enumerable: true, get: function () { return array_util_1._mapToObject; } });
|
|
22
|
-
Object.defineProperty(exports, "_shuffle", { enumerable: true, get: function () { return array_util_1._shuffle; } });
|
|
23
|
-
Object.defineProperty(exports, "_sortBy", { enumerable: true, get: function () { return array_util_1._sortBy; } });
|
|
24
|
-
Object.defineProperty(exports, "_sum", { enumerable: true, get: function () { return array_util_1._sum; } });
|
|
25
|
-
Object.defineProperty(exports, "_sumBy", { enumerable: true, get: function () { return array_util_1._sumBy; } });
|
|
26
|
-
Object.defineProperty(exports, "_takeRightWhile", { enumerable: true, get: function () { return array_util_1._takeRightWhile; } });
|
|
27
|
-
Object.defineProperty(exports, "_takeWhile", { enumerable: true, get: function () { return array_util_1._takeWhile; } });
|
|
28
|
-
Object.defineProperty(exports, "_uniq", { enumerable: true, get: function () { return array_util_1._uniq; } });
|
|
29
|
-
Object.defineProperty(exports, "_uniqBy", { enumerable: true, get: function () { return array_util_1._uniqBy; } });
|
|
30
|
-
const lazy_1 = require("./lazy");
|
|
31
|
-
Object.defineProperty(exports, "_defineLazyProperty", { enumerable: true, get: function () { return lazy_1._defineLazyProperty; } });
|
|
32
|
-
Object.defineProperty(exports, "_defineLazyProps", { enumerable: true, get: function () { return lazy_1._defineLazyProps; } });
|
|
33
|
-
Object.defineProperty(exports, "_lazyValue", { enumerable: true, get: function () { return lazy_1._lazyValue; } });
|
|
34
|
-
const url_util_1 = require("./string/url.util");
|
|
35
|
-
Object.defineProperty(exports, "_parseQueryString", { enumerable: true, get: function () { return url_util_1._parseQueryString; } });
|
|
36
|
-
const range_1 = require("./array/range");
|
|
37
|
-
Object.defineProperty(exports, "_range", { enumerable: true, get: function () { return range_1._range; } });
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./array/array.util"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./lazy"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./string/url.util"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./array/range"), exports);
|
|
38
10
|
const createPromiseDecorator_1 = require("./decorators/createPromiseDecorator");
|
|
39
11
|
Object.defineProperty(exports, "_createPromiseDecorator", { enumerable: true, get: function () { return createPromiseDecorator_1._createPromiseDecorator; } });
|
|
40
12
|
const debounce_1 = require("./decorators/debounce");
|
|
@@ -86,110 +58,42 @@ Object.defineProperty(exports, "mergeJsonSchemaObjects", { enumerable: true, get
|
|
|
86
58
|
const jsonSchemaBuilder_1 = require("./json-schema/jsonSchemaBuilder");
|
|
87
59
|
Object.defineProperty(exports, "jsonSchema", { enumerable: true, get: function () { return jsonSchemaBuilder_1.jsonSchema; } });
|
|
88
60
|
Object.defineProperty(exports, "JsonSchemaAnyBuilder", { enumerable: true, get: function () { return jsonSchemaBuilder_1.JsonSchemaAnyBuilder; } });
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Object.defineProperty(exports, "_createDeterministicRandom", { enumerable: true, get: function () { return createDeterministicRandom_1._createDeterministicRandom; } });
|
|
98
|
-
const number_util_1 = require("./number/number.util");
|
|
99
|
-
Object.defineProperty(exports, "_clamp", { enumerable: true, get: function () { return number_util_1._clamp; } });
|
|
100
|
-
Object.defineProperty(exports, "_inRange", { enumerable: true, get: function () { return number_util_1._inRange; } });
|
|
101
|
-
Object.defineProperty(exports, "_randomInt", { enumerable: true, get: function () { return number_util_1._randomInt; } });
|
|
102
|
-
Object.defineProperty(exports, "_randomArrayItem", { enumerable: true, get: function () { return number_util_1._randomArrayItem; } });
|
|
103
|
-
Object.defineProperty(exports, "_round", { enumerable: true, get: function () { return number_util_1._round; } });
|
|
104
|
-
Object.defineProperty(exports, "_sortNumbers", { enumerable: true, get: function () { return number_util_1._sortNumbers; } });
|
|
105
|
-
Object.defineProperty(exports, "_toFixed", { enumerable: true, get: function () { return number_util_1._toFixed; } });
|
|
106
|
-
Object.defineProperty(exports, "_toPrecision", { enumerable: true, get: function () { return number_util_1._toPrecision; } });
|
|
107
|
-
const deepEquals_1 = require("./object/deepEquals");
|
|
108
|
-
Object.defineProperty(exports, "_deepEquals", { enumerable: true, get: function () { return deepEquals_1._deepEquals; } });
|
|
109
|
-
const object_util_1 = require("./object/object.util");
|
|
110
|
-
Object.defineProperty(exports, "_deepCopy", { enumerable: true, get: function () { return object_util_1._deepCopy; } });
|
|
111
|
-
Object.defineProperty(exports, "_deepTrim", { enumerable: true, get: function () { return object_util_1._deepTrim; } });
|
|
112
|
-
Object.defineProperty(exports, "_filterEmptyArrays", { enumerable: true, get: function () { return object_util_1._filterEmptyArrays; } });
|
|
113
|
-
Object.defineProperty(exports, "_filterEmptyValues", { enumerable: true, get: function () { return object_util_1._filterEmptyValues; } });
|
|
114
|
-
Object.defineProperty(exports, "_filterFalsyValues", { enumerable: true, get: function () { return object_util_1._filterFalsyValues; } });
|
|
115
|
-
Object.defineProperty(exports, "_filterNullishValues", { enumerable: true, get: function () { return object_util_1._filterNullishValues; } });
|
|
116
|
-
Object.defineProperty(exports, "_filterObject", { enumerable: true, get: function () { return object_util_1._filterObject; } });
|
|
117
|
-
Object.defineProperty(exports, "_filterUndefinedValues", { enumerable: true, get: function () { return object_util_1._filterUndefinedValues; } });
|
|
118
|
-
Object.defineProperty(exports, "_findKeyByValue", { enumerable: true, get: function () { return object_util_1._findKeyByValue; } });
|
|
119
|
-
Object.defineProperty(exports, "_get", { enumerable: true, get: function () { return object_util_1._get; } });
|
|
120
|
-
Object.defineProperty(exports, "_has", { enumerable: true, get: function () { return object_util_1._has; } });
|
|
121
|
-
Object.defineProperty(exports, "_invert", { enumerable: true, get: function () { return object_util_1._invert; } });
|
|
122
|
-
Object.defineProperty(exports, "_invertMap", { enumerable: true, get: function () { return object_util_1._invertMap; } });
|
|
123
|
-
Object.defineProperty(exports, "_isEmpty", { enumerable: true, get: function () { return object_util_1._isEmpty; } });
|
|
124
|
-
Object.defineProperty(exports, "_isEmptyObject", { enumerable: true, get: function () { return object_util_1._isEmptyObject; } });
|
|
125
|
-
Object.defineProperty(exports, "_isObject", { enumerable: true, get: function () { return object_util_1._isObject; } });
|
|
126
|
-
Object.defineProperty(exports, "_isPrimitive", { enumerable: true, get: function () { return object_util_1._isPrimitive; } });
|
|
127
|
-
Object.defineProperty(exports, "_mapKeys", { enumerable: true, get: function () { return object_util_1._mapKeys; } });
|
|
128
|
-
Object.defineProperty(exports, "_mapObject", { enumerable: true, get: function () { return object_util_1._mapObject; } });
|
|
129
|
-
Object.defineProperty(exports, "_mapValues", { enumerable: true, get: function () { return object_util_1._mapValues; } });
|
|
130
|
-
Object.defineProperty(exports, "_mask", { enumerable: true, get: function () { return object_util_1._mask; } });
|
|
131
|
-
Object.defineProperty(exports, "_merge", { enumerable: true, get: function () { return object_util_1._merge; } });
|
|
132
|
-
Object.defineProperty(exports, "_objectNullValuesToUndefined", { enumerable: true, get: function () { return object_util_1._objectNullValuesToUndefined; } });
|
|
133
|
-
Object.defineProperty(exports, "_omit", { enumerable: true, get: function () { return object_util_1._omit; } });
|
|
134
|
-
Object.defineProperty(exports, "_pick", { enumerable: true, get: function () { return object_util_1._pick; } });
|
|
135
|
-
Object.defineProperty(exports, "_set", { enumerable: true, get: function () { return object_util_1._set; } });
|
|
136
|
-
Object.defineProperty(exports, "_undefinedIfEmpty", { enumerable: true, get: function () { return object_util_1._undefinedIfEmpty; } });
|
|
137
|
-
Object.defineProperty(exports, "_unset", { enumerable: true, get: function () { return object_util_1._unset; } });
|
|
138
|
-
const sortObject_1 = require("./object/sortObject");
|
|
139
|
-
Object.defineProperty(exports, "_sortObject", { enumerable: true, get: function () { return sortObject_1._sortObject; } });
|
|
140
|
-
const sortObjectDeep_1 = require("./object/sortObjectDeep");
|
|
141
|
-
Object.defineProperty(exports, "_sortObjectDeep", { enumerable: true, get: function () { return sortObjectDeep_1._sortObjectDeep; } });
|
|
61
|
+
(0, tslib_1.__exportStar)(require("./math/math.util"), exports);
|
|
62
|
+
(0, tslib_1.__exportStar)(require("./math/sma"), exports);
|
|
63
|
+
(0, tslib_1.__exportStar)(require("./number/createDeterministicRandom"), exports);
|
|
64
|
+
(0, tslib_1.__exportStar)(require("./number/number.util"), exports);
|
|
65
|
+
(0, tslib_1.__exportStar)(require("./object/deepEquals"), exports);
|
|
66
|
+
(0, tslib_1.__exportStar)(require("./object/object.util"), exports);
|
|
67
|
+
(0, tslib_1.__exportStar)(require("./object/sortObject"), exports);
|
|
68
|
+
(0, tslib_1.__exportStar)(require("./object/sortObjectDeep"), exports);
|
|
142
69
|
const AggregatedError_1 = require("./promise/AggregatedError");
|
|
143
70
|
Object.defineProperty(exports, "AggregatedError", { enumerable: true, get: function () { return AggregatedError_1.AggregatedError; } });
|
|
144
|
-
|
|
145
|
-
Object.defineProperty(exports, "pBatch", { enumerable: true, get: function () { return pBatch_1.pBatch; } });
|
|
71
|
+
(0, tslib_1.__exportStar)(require("./promise/pBatch"), exports);
|
|
146
72
|
const pDefer_1 = require("./promise/pDefer");
|
|
147
73
|
Object.defineProperty(exports, "pDefer", { enumerable: true, get: function () { return pDefer_1.pDefer; } });
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Object.defineProperty(exports, "pFilter", { enumerable: true, get: function () { return pFilter_1.pFilter; } });
|
|
152
|
-
const pHang_1 = require("./promise/pHang");
|
|
153
|
-
Object.defineProperty(exports, "pHang", { enumerable: true, get: function () { return pHang_1.pHang; } });
|
|
74
|
+
(0, tslib_1.__exportStar)(require("./promise/pDelay"), exports);
|
|
75
|
+
(0, tslib_1.__exportStar)(require("./promise/pFilter"), exports);
|
|
76
|
+
(0, tslib_1.__exportStar)(require("./promise/pHang"), exports);
|
|
154
77
|
const pMap_1 = require("./promise/pMap");
|
|
155
78
|
Object.defineProperty(exports, "pMap", { enumerable: true, get: function () { return pMap_1.pMap; } });
|
|
156
|
-
|
|
157
|
-
Object.defineProperty(exports, "pProps", { enumerable: true, get: function () { return pProps_1.pProps; } });
|
|
79
|
+
(0, tslib_1.__exportStar)(require("./promise/pProps"), exports);
|
|
158
80
|
const pRetry_1 = require("./promise/pRetry");
|
|
159
81
|
Object.defineProperty(exports, "pRetry", { enumerable: true, get: function () { return pRetry_1.pRetry; } });
|
|
160
|
-
|
|
161
|
-
Object.defineProperty(exports, "pState", { enumerable: true, get: function () { return pState_1.pState; } });
|
|
82
|
+
(0, tslib_1.__exportStar)(require("./promise/pState"), exports);
|
|
162
83
|
const pTimeout_1 = require("./promise/pTimeout");
|
|
163
84
|
Object.defineProperty(exports, "pTimeout", { enumerable: true, get: function () { return pTimeout_1.pTimeout; } });
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
Object.defineProperty(exports, "_kebabCase", { enumerable: true, get: function () { return case_1._kebabCase; } });
|
|
169
|
-
Object.defineProperty(exports, "_snakeCase", { enumerable: true, get: function () { return case_1._snakeCase; } });
|
|
170
|
-
const json_util_1 = require("./string/json.util");
|
|
171
|
-
Object.defineProperty(exports, "_jsonParseIfPossible", { enumerable: true, get: function () { return json_util_1._jsonParseIfPossible; } });
|
|
172
|
-
const string_util_1 = require("./string/string.util");
|
|
173
|
-
Object.defineProperty(exports, "_capitalize", { enumerable: true, get: function () { return string_util_1._capitalize; } });
|
|
174
|
-
Object.defineProperty(exports, "_lowerFirst", { enumerable: true, get: function () { return string_util_1._lowerFirst; } });
|
|
175
|
-
Object.defineProperty(exports, "_nl2br", { enumerable: true, get: function () { return string_util_1._nl2br; } });
|
|
176
|
-
Object.defineProperty(exports, "_removeWhitespace", { enumerable: true, get: function () { return string_util_1._removeWhitespace; } });
|
|
177
|
-
Object.defineProperty(exports, "_replaceAll", { enumerable: true, get: function () { return string_util_1._replaceAll; } });
|
|
178
|
-
Object.defineProperty(exports, "_split", { enumerable: true, get: function () { return string_util_1._split; } });
|
|
179
|
-
Object.defineProperty(exports, "_substringAfter", { enumerable: true, get: function () { return string_util_1._substringAfter; } });
|
|
180
|
-
Object.defineProperty(exports, "_substringAfterLast", { enumerable: true, get: function () { return string_util_1._substringAfterLast; } });
|
|
181
|
-
Object.defineProperty(exports, "_substringBefore", { enumerable: true, get: function () { return string_util_1._substringBefore; } });
|
|
182
|
-
Object.defineProperty(exports, "_substringBeforeLast", { enumerable: true, get: function () { return string_util_1._substringBeforeLast; } });
|
|
183
|
-
Object.defineProperty(exports, "_substringBetweenLast", { enumerable: true, get: function () { return string_util_1._substringBetweenLast; } });
|
|
184
|
-
Object.defineProperty(exports, "_truncate", { enumerable: true, get: function () { return string_util_1._truncate; } });
|
|
185
|
-
Object.defineProperty(exports, "_truncateMiddle", { enumerable: true, get: function () { return string_util_1._truncateMiddle; } });
|
|
186
|
-
Object.defineProperty(exports, "_upperFirst", { enumerable: true, get: function () { return string_util_1._upperFirst; } });
|
|
85
|
+
(0, tslib_1.__exportStar)(require("./promise/pTuple"), exports);
|
|
86
|
+
(0, tslib_1.__exportStar)(require("./string/case"), exports);
|
|
87
|
+
(0, tslib_1.__exportStar)(require("./string/json.util"), exports);
|
|
88
|
+
(0, tslib_1.__exportStar)(require("./string/string.util"), exports);
|
|
187
89
|
const stringifyAny_1 = require("./string/stringifyAny");
|
|
188
90
|
Object.defineProperty(exports, "_stringifyAny", { enumerable: true, get: function () { return stringifyAny_1._stringifyAny; } });
|
|
189
91
|
const time_util_1 = require("./time/time.util");
|
|
190
92
|
Object.defineProperty(exports, "_ms", { enumerable: true, get: function () { return time_util_1._ms; } });
|
|
191
93
|
Object.defineProperty(exports, "_since", { enumerable: true, get: function () { return time_util_1._since; } });
|
|
192
94
|
const types_1 = require("./types");
|
|
95
|
+
Object.defineProperty(exports, "END", { enumerable: true, get: function () { return types_1.END; } });
|
|
96
|
+
Object.defineProperty(exports, "SKIP", { enumerable: true, get: function () { return types_1.SKIP; } });
|
|
193
97
|
Object.defineProperty(exports, "_noop", { enumerable: true, get: function () { return types_1._noop; } });
|
|
194
98
|
Object.defineProperty(exports, "_objectKeys", { enumerable: true, get: function () { return types_1._objectKeys; } });
|
|
195
99
|
Object.defineProperty(exports, "_passNothingPredicate", { enumerable: true, get: function () { return types_1._passNothingPredicate; } });
|
|
@@ -216,3 +120,5 @@ const safeJsonStringify_1 = require("./string/safeJsonStringify");
|
|
|
216
120
|
Object.defineProperty(exports, "_safeJsonStringify", { enumerable: true, get: function () { return safeJsonStringify_1._safeJsonStringify; } });
|
|
217
121
|
const pQueue_1 = require("./promise/pQueue");
|
|
218
122
|
Object.defineProperty(exports, "PQueue", { enumerable: true, get: function () { return pQueue_1.PQueue; } });
|
|
123
|
+
(0, tslib_1.__exportStar)(require("./seq/seq"), exports);
|
|
124
|
+
(0, tslib_1.__exportStar)(require("./math/stack.util"), exports);
|
package/dist/math/math.util.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export declare function _averageWeighted(values: number[], weights: number[]): n
|
|
|
24
24
|
* // 3
|
|
25
25
|
*/
|
|
26
26
|
export declare function _percentile(values: number[], pc: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* A tiny bit more efficient function than calling _percentile individually.
|
|
29
|
+
*/
|
|
30
|
+
export declare function _percentiles(values: number[], pcs: number[]): Record<number, number>;
|
|
27
31
|
/**
|
|
28
32
|
* @example
|
|
29
33
|
*
|
package/dist/math/math.util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._median = exports._percentile = exports._averageWeighted = exports._average = void 0;
|
|
3
|
+
exports._median = exports._percentiles = exports._percentile = exports._averageWeighted = exports._average = void 0;
|
|
4
4
|
const number_util_1 = require("../number/number.util");
|
|
5
5
|
/**
|
|
6
6
|
* @returns Average of the array of numbers
|
|
@@ -45,6 +45,23 @@ function _percentile(values, pc) {
|
|
|
45
45
|
return _averageWeighted([sorted[floorPos], sorted[ceilPos]], [1 - dec, dec]);
|
|
46
46
|
}
|
|
47
47
|
exports._percentile = _percentile;
|
|
48
|
+
/**
|
|
49
|
+
* A tiny bit more efficient function than calling _percentile individually.
|
|
50
|
+
*/
|
|
51
|
+
function _percentiles(values, pcs) {
|
|
52
|
+
const r = {};
|
|
53
|
+
const sorted = (0, number_util_1._sortNumbers)(values);
|
|
54
|
+
pcs.forEach(pc => {
|
|
55
|
+
// Floating pos in the range of [0; length - 1]
|
|
56
|
+
const pos = ((values.length - 1) * pc) / 100;
|
|
57
|
+
const dec = pos % 1;
|
|
58
|
+
const floorPos = Math.floor(pos);
|
|
59
|
+
const ceilPos = Math.ceil(pos);
|
|
60
|
+
r[pc] = _averageWeighted([sorted[floorPos], sorted[ceilPos]], [1 - dec, dec]);
|
|
61
|
+
});
|
|
62
|
+
return r;
|
|
63
|
+
}
|
|
64
|
+
exports._percentiles = _percentiles;
|
|
48
65
|
/**
|
|
49
66
|
* @example
|
|
50
67
|
*
|
package/dist/math/sma.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Implements a Simple Moving Average algorithm.
|
|
3
3
|
*/
|
|
4
4
|
export declare class SimpleMovingAverage {
|
|
5
|
-
size: number;
|
|
6
|
-
data: number[];
|
|
5
|
+
readonly size: number;
|
|
6
|
+
readonly data: number[];
|
|
7
7
|
constructor(size: number, data?: number[]);
|
|
8
8
|
/**
|
|
9
9
|
* Next index of array to push to
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements a "round-robin" Stack ("first-in last-out" aka FILO) with a limited size.
|
|
3
|
+
* Like an array of a fixed size. When it runs out of space - it starts writing on top of itself
|
|
4
|
+
* from index 0.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class Stack<T> {
|
|
9
|
+
readonly size: number;
|
|
10
|
+
constructor(size: number);
|
|
11
|
+
/**
|
|
12
|
+
* Index of a slot to get written TO next.
|
|
13
|
+
* Currently this slot contains OLDEST item (if any).
|
|
14
|
+
*/
|
|
15
|
+
private nextIndex;
|
|
16
|
+
readonly items: T[];
|
|
17
|
+
push(item: T): this;
|
|
18
|
+
/**
|
|
19
|
+
* Fill (overwrite) the whole Stack (all its items) with the passed `item`.
|
|
20
|
+
*/
|
|
21
|
+
fill(item: T): this;
|
|
22
|
+
/**
|
|
23
|
+
* Returns last items in the right order.
|
|
24
|
+
* Unlike raw `items` property that returns "items buffer" as-is (not ordered properly).
|
|
25
|
+
*/
|
|
26
|
+
get itemsOrdered(): T[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fixed-size FILO stack of Numbers.
|
|
30
|
+
* Has convenience stat methods, e.g percentile, avg, etc.
|
|
31
|
+
*/
|
|
32
|
+
export declare class NumberStack extends Stack<number> {
|
|
33
|
+
avg(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns null if Stack is empty.
|
|
36
|
+
*/
|
|
37
|
+
avgOrNull(): number | null;
|
|
38
|
+
median(): number;
|
|
39
|
+
medianOrNull(): number | null;
|
|
40
|
+
/**
|
|
41
|
+
* `pc` is a number from 0 to 100 inclusive.
|
|
42
|
+
*/
|
|
43
|
+
percentile(pc: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* `pc` is a number from 0 to 100 inclusive.
|
|
46
|
+
* Returns null if Stack is empty.
|
|
47
|
+
*/
|
|
48
|
+
percentileOrNull(pc: number): number | null;
|
|
49
|
+
percentiles(pcs: number[]): Record<number, number>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberStack = exports.Stack = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
/**
|
|
6
|
+
* Implements a "round-robin" Stack ("first-in last-out" aka FILO) with a limited size.
|
|
7
|
+
* Like an array of a fixed size. When it runs out of space - it starts writing on top of itself
|
|
8
|
+
* from index 0.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
class Stack {
|
|
13
|
+
constructor(size) {
|
|
14
|
+
this.size = size;
|
|
15
|
+
/**
|
|
16
|
+
* Index of a slot to get written TO next.
|
|
17
|
+
* Currently this slot contains OLDEST item (if any).
|
|
18
|
+
*/
|
|
19
|
+
this.nextIndex = 0;
|
|
20
|
+
this.items = [];
|
|
21
|
+
}
|
|
22
|
+
push(item) {
|
|
23
|
+
this.items[this.nextIndex] = item;
|
|
24
|
+
this.nextIndex = this.nextIndex === this.size - 1 ? 0 : this.nextIndex + 1;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fill (overwrite) the whole Stack (all its items) with the passed `item`.
|
|
29
|
+
*/
|
|
30
|
+
fill(item) {
|
|
31
|
+
(0, index_1._range)(this.size).forEach(i => (this.items[i] = item));
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns last items in the right order.
|
|
36
|
+
* Unlike raw `items` property that returns "items buffer" as-is (not ordered properly).
|
|
37
|
+
*/
|
|
38
|
+
get itemsOrdered() {
|
|
39
|
+
if (this.items.length < this.size) {
|
|
40
|
+
// Buffer is not filled yet, just return it as-is
|
|
41
|
+
return this.items;
|
|
42
|
+
}
|
|
43
|
+
// Buffer was filled and started to "overwrite itself", will need to return 2 slices
|
|
44
|
+
return [...this.items.slice(this.nextIndex), ...this.items.slice(0, this.nextIndex)];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Stack = Stack;
|
|
48
|
+
/**
|
|
49
|
+
* Fixed-size FILO stack of Numbers.
|
|
50
|
+
* Has convenience stat methods, e.g percentile, avg, etc.
|
|
51
|
+
*/
|
|
52
|
+
class NumberStack extends Stack {
|
|
53
|
+
avg() {
|
|
54
|
+
// _assert(this.items.length, 'NumberStack.avg cannot be called on empty stack')
|
|
55
|
+
return (0, index_1._average)(this.items);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns null if Stack is empty.
|
|
59
|
+
*/
|
|
60
|
+
avgOrNull() {
|
|
61
|
+
return this.items.length === 0 ? null : (0, index_1._average)(this.items);
|
|
62
|
+
}
|
|
63
|
+
median() {
|
|
64
|
+
return (0, index_1._percentile)(this.items, 50);
|
|
65
|
+
}
|
|
66
|
+
medianOrNull() {
|
|
67
|
+
return this.items.length === 0 ? null : (0, index_1._percentile)(this.items, 50);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* `pc` is a number from 0 to 100 inclusive.
|
|
71
|
+
*/
|
|
72
|
+
percentile(pc) {
|
|
73
|
+
// _assert(this.items.length, 'NumberStack.percentile cannot be called on empty stack')
|
|
74
|
+
return (0, index_1._percentile)(this.items, pc);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* `pc` is a number from 0 to 100 inclusive.
|
|
78
|
+
* Returns null if Stack is empty.
|
|
79
|
+
*/
|
|
80
|
+
percentileOrNull(pc) {
|
|
81
|
+
return this.items.length === 0 ? null : (0, index_1._percentile)(this.items, pc);
|
|
82
|
+
}
|
|
83
|
+
percentiles(pcs) {
|
|
84
|
+
return (0, index_1._percentiles)(this.items, pcs);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.NumberStack = NumberStack;
|
|
@@ -44,7 +44,7 @@ export declare function _toFixed(n: number, fractionDigits: number): number;
|
|
|
44
44
|
* _toPrecision(1634.56, 1)
|
|
45
45
|
* // 2000
|
|
46
46
|
*
|
|
47
|
-
* _toPrecision(
|
|
47
|
+
* _toPrecision(1634.56, 2)
|
|
48
48
|
* // 1600
|
|
49
49
|
*/
|
|
50
50
|
export declare function _toPrecision(n: number, precision: number): number;
|
package/dist/promise/pBatch.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BatchResult } from '..';
|
|
2
|
-
import { AsyncMapper } from '../types';
|
|
1
|
+
import { AbortableAsyncMapper, BatchResult } from '..';
|
|
3
2
|
/**
|
|
4
3
|
* Like pMap, but doesn't fail on errors, instead returns both successful results and errors.
|
|
5
4
|
*/
|
|
6
|
-
export declare function pBatch<IN, OUT>(iterable: Iterable<IN | PromiseLike<IN>>, mapper:
|
|
5
|
+
export declare function pBatch<IN, OUT>(iterable: Iterable<IN | PromiseLike<IN>>, mapper: AbortableAsyncMapper<IN, OUT>, opt?: {
|
|
7
6
|
concurrency?: number;
|
|
8
7
|
}): Promise<BatchResult<OUT>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbortableAsyncPredicate } from '../types';
|
|
2
2
|
import { PMapOptions } from './pMap';
|
|
3
|
-
export declare function pFilter<T>(iterable: Iterable<T | PromiseLike<T>>, filterFn:
|
|
3
|
+
export declare function pFilter<T>(iterable: Iterable<T | PromiseLike<T>>, filterFn: AbortableAsyncPredicate<T>, opt?: PMapOptions): Promise<T[]>;
|
package/dist/promise/pMap.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ErrorMode } from '..';
|
|
2
|
-
import { AsyncMapper } from '../types';
|
|
1
|
+
import { AbortableAsyncMapper, ErrorMode } from '..';
|
|
3
2
|
export interface PMapOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Number of concurrently pending promises returned by `mapper`.
|
|
@@ -42,4 +41,4 @@ export interface PMapOptions {
|
|
|
42
41
|
* //=> ['http://ava.li/', 'http://todomvc.com/']
|
|
43
42
|
* })();
|
|
44
43
|
*/
|
|
45
|
-
export declare function pMap<IN, OUT>(iterable: Iterable<IN | PromiseLike<IN>>, mapper:
|
|
44
|
+
export declare function pMap<IN, OUT>(iterable: Iterable<IN | PromiseLike<IN>>, mapper: AbortableAsyncMapper<IN, OUT>, opt?: PMapOptions): Promise<OUT[]>;
|
package/dist/promise/pMap.js
CHANGED
|
@@ -43,25 +43,27 @@ async function pMap(iterable, mapper, opt = {}) {
|
|
|
43
43
|
const ret = [];
|
|
44
44
|
const iterator = iterable[Symbol.iterator]();
|
|
45
45
|
const errors = [];
|
|
46
|
-
let
|
|
46
|
+
let isSettled = false;
|
|
47
47
|
let isIterableDone = false;
|
|
48
48
|
let resolvingCount = 0;
|
|
49
49
|
let currentIndex = 0;
|
|
50
|
-
const next = () => {
|
|
51
|
-
if (
|
|
50
|
+
const next = (skipped = false) => {
|
|
51
|
+
if (isSettled) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const nextItem = iterator.next();
|
|
55
55
|
const i = currentIndex;
|
|
56
|
-
|
|
56
|
+
if (!skipped)
|
|
57
|
+
currentIndex++;
|
|
57
58
|
if (nextItem.done) {
|
|
58
59
|
isIterableDone = true;
|
|
59
60
|
if (resolvingCount === 0) {
|
|
61
|
+
const r = ret.filter(r => r !== __1.SKIP);
|
|
60
62
|
if (errors.length && errorMode === __1.ErrorMode.THROW_AGGREGATED) {
|
|
61
|
-
reject(new AggregatedError_1.AggregatedError(errors,
|
|
63
|
+
reject(new AggregatedError_1.AggregatedError(errors, r));
|
|
62
64
|
}
|
|
63
65
|
else {
|
|
64
|
-
resolve(
|
|
66
|
+
resolve(r);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
return;
|
|
@@ -70,12 +72,16 @@ async function pMap(iterable, mapper, opt = {}) {
|
|
|
70
72
|
Promise.resolve(nextItem.value)
|
|
71
73
|
.then(async (element) => await mapper(element, i))
|
|
72
74
|
.then(value => {
|
|
75
|
+
if (value === __1.END) {
|
|
76
|
+
isSettled = true;
|
|
77
|
+
return resolve(ret.filter(r => r !== __1.SKIP));
|
|
78
|
+
}
|
|
73
79
|
ret[i] = value;
|
|
74
80
|
resolvingCount--;
|
|
75
81
|
next();
|
|
76
82
|
}, err => {
|
|
77
83
|
if (errorMode === __1.ErrorMode.THROW_IMMEDIATELY) {
|
|
78
|
-
|
|
84
|
+
isSettled = true;
|
|
79
85
|
reject(err);
|
|
80
86
|
}
|
|
81
87
|
else {
|
package/dist/promise/pProps.d.ts
CHANGED