@naturalcycles/js-lib 15.31.0 → 15.33.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.
@@ -1,4 +1,4 @@
1
- import type { AbortableAsyncMapper, AbortableAsyncPredicate, Promisable } from '../types.js';
1
+ import type { AbortableAsyncMapper, AbortableAsyncPredicate, AbortableMapper, AbortablePredicate, Promisable } from '../types.js';
2
2
  import { END } from '../types.js';
3
3
  /**
4
4
  * Similar to Iterable2, but for AsyncIterable.
@@ -20,8 +20,13 @@ export declare class AsyncIterable2<T> implements AsyncIterable<T> {
20
20
  toArray(): Promise<T[]>;
21
21
  forEach(cb: (v: T, i: number) => Promisable<any | typeof END>): Promise<void>;
22
22
  some(cb: AbortableAsyncPredicate<T>): Promise<boolean>;
23
+ someSync(cb: AbortablePredicate<T>): Promise<boolean>;
23
24
  every(cb: AbortableAsyncPredicate<T>): Promise<boolean>;
25
+ everySync(cb: AbortablePredicate<T>): Promise<boolean>;
24
26
  find(cb: AbortableAsyncPredicate<T>): Promise<T | undefined>;
27
+ findSync(cb: AbortablePredicate<T>): Promise<T | undefined>;
25
28
  filter(cb: AbortableAsyncPredicate<T>): AsyncIterable2<T>;
29
+ filterSync(cb: AbortablePredicate<T>): AsyncIterable2<T>;
26
30
  map<OUT>(mapper: AbortableAsyncMapper<T, OUT>): AsyncIterable2<OUT>;
31
+ mapSync<OUT>(mapper: AbortableMapper<T, OUT>): AsyncIterable2<OUT>;
27
32
  }
@@ -51,6 +51,9 @@ export class AsyncIterable2 {
51
51
  async some(cb) {
52
52
  return !!(await this.find(cb));
53
53
  }
54
+ async someSync(cb) {
55
+ return !!(await this.findSync(cb));
56
+ }
54
57
  async every(cb) {
55
58
  let i = 0;
56
59
  for await (const v of this.it) {
@@ -60,6 +63,15 @@ export class AsyncIterable2 {
60
63
  }
61
64
  return true;
62
65
  }
66
+ async everySync(cb) {
67
+ let i = 0;
68
+ for await (const v of this.it) {
69
+ const r = cb(v, i++);
70
+ if (r === END || !r)
71
+ return false;
72
+ }
73
+ return true;
74
+ }
63
75
  async find(cb) {
64
76
  let i = 0;
65
77
  for await (const v of this.it) {
@@ -70,6 +82,16 @@ export class AsyncIterable2 {
70
82
  return v;
71
83
  }
72
84
  }
85
+ async findSync(cb) {
86
+ let i = 0;
87
+ for await (const v of this.it) {
88
+ const r = cb(v, i++);
89
+ if (r === END)
90
+ return;
91
+ if (r)
92
+ return v;
93
+ }
94
+ }
73
95
  filter(cb) {
74
96
  const { it } = this;
75
97
  return new AsyncIterable2({
@@ -85,6 +107,21 @@ export class AsyncIterable2 {
85
107
  },
86
108
  });
87
109
  }
110
+ filterSync(cb) {
111
+ const { it } = this;
112
+ return new AsyncIterable2({
113
+ async *[Symbol.asyncIterator]() {
114
+ let i = 0;
115
+ for await (const v of it) {
116
+ const r = cb(v, i++);
117
+ if (r === END)
118
+ return;
119
+ if (r)
120
+ yield v;
121
+ }
122
+ },
123
+ });
124
+ }
88
125
  map(mapper) {
89
126
  const { it } = this;
90
127
  return new AsyncIterable2({
@@ -101,4 +138,20 @@ export class AsyncIterable2 {
101
138
  },
102
139
  });
103
140
  }
141
+ mapSync(mapper) {
142
+ const { it } = this;
143
+ return new AsyncIterable2({
144
+ async *[Symbol.asyncIterator]() {
145
+ let i = 0;
146
+ for await (const v of it) {
147
+ const r = mapper(v, i++);
148
+ if (r === END)
149
+ return;
150
+ if (r === SKIP)
151
+ continue;
152
+ yield r;
153
+ }
154
+ },
155
+ });
156
+ }
104
157
  }
@@ -3,13 +3,17 @@ import type { MutateOptions } from '../array/array.util.js';
3
3
  * These levels follow console.* naming,
4
4
  * so you can use console[level] safely.
5
5
  *
6
- * `log` is considered default level.
6
+ * `debug` is not enabled by default, and is useful when debugging is needed.
7
7
  *
8
- * For simplicity - only these 3 levels are kept.
8
+ * `log` is considered default level, and is enabled by default.
9
+ *
10
+ * `warn` is for warnings - things that are not super-severe to be an error, but should not happen
11
+ *
12
+ * `error` level would only log errors
9
13
  *
10
14
  * @experimental
11
15
  */
12
- export type CommonLogLevel = 'log' | 'warn' | 'error';
16
+ export type CommonLogLevel = 'debug' | 'log' | 'warn' | 'error';
13
17
  export declare const commonLogLevelNumber: Record<CommonLogLevel, number>;
14
18
  /**
15
19
  * Function that takes any number of arguments and logs them all.
@@ -26,20 +30,19 @@ export type CommonLogWithLevelFunction = (level: CommonLogLevel, args: any[]) =>
26
30
  * @experimental
27
31
  */
28
32
  export interface CommonLogger {
33
+ debug: CommonLogFunction;
29
34
  log: CommonLogFunction;
30
35
  warn: CommonLogFunction;
31
36
  error: CommonLogFunction;
32
37
  }
33
38
  /**
34
39
  * SimpleLogger that does nothing (noop).
35
- *
36
- * @experimental
37
40
  */
38
41
  export declare const commonLoggerNoop: CommonLogger;
39
42
  /**
40
43
  * Creates a "child" logger that is "limited" to the specified CommonLogLevel.
41
44
  */
42
- export declare function commonLoggerMinLevel(logger: CommonLogger, minLevel: CommonLogLevel, opt?: MutateOptions): CommonLogger;
45
+ export declare function createCommonLoggerAtLevel(logger?: CommonLogger, minLevel?: CommonLogLevel, opt?: MutateOptions): CommonLogger;
43
46
  /**
44
47
  * Creates a "proxy" CommonLogger that pipes log messages to all provided sub-loggers.
45
48
  */
@@ -1,15 +1,16 @@
1
+ // copy-pasted to avoid weird circular dependency
1
2
  const _noop = (..._args) => undefined;
2
3
  export const commonLogLevelNumber = {
3
- log: 10,
4
+ debug: 10,
5
+ log: 20,
4
6
  warn: 20,
5
7
  error: 30,
6
8
  };
7
9
  /**
8
10
  * SimpleLogger that does nothing (noop).
9
- *
10
- * @experimental
11
11
  */
12
12
  export const commonLoggerNoop = {
13
+ debug: _noop,
13
14
  log: _noop,
14
15
  warn: _noop,
15
16
  error: _noop,
@@ -17,21 +18,24 @@ export const commonLoggerNoop = {
17
18
  /**
18
19
  * Creates a "child" logger that is "limited" to the specified CommonLogLevel.
19
20
  */
20
- export function commonLoggerMinLevel(logger, minLevel, opt = {}) {
21
+ export function createCommonLoggerAtLevel(logger = console, minLevel = 'log', opt = {}) {
21
22
  const level = commonLogLevelNumber[minLevel];
22
23
  if (opt.mutate) {
23
- if (level > commonLogLevelNumber['log']) {
24
- logger.log = _noop;
25
- if (level > commonLogLevelNumber['warn']) {
26
- logger.warn = _noop;
27
- if (level > commonLogLevelNumber['error']) {
28
- logger.error = _noop;
24
+ if (level > commonLogLevelNumber['debug']) {
25
+ logger.debug = _noop;
26
+ if (level > commonLogLevelNumber['log']) {
27
+ logger.log = _noop;
28
+ if (level > commonLogLevelNumber['warn']) {
29
+ logger.warn = _noop;
30
+ if (level > commonLogLevelNumber['error']) {
31
+ logger.error = _noop;
32
+ }
29
33
  }
30
34
  }
31
35
  }
32
36
  return logger;
33
37
  }
34
- if (level <= commonLogLevelNumber['log']) {
38
+ if (level <= commonLogLevelNumber['debug']) {
35
39
  // All levels are kept
36
40
  return logger;
37
41
  }
@@ -40,7 +44,8 @@ export function commonLoggerMinLevel(logger, minLevel, opt = {}) {
40
44
  return commonLoggerNoop;
41
45
  }
42
46
  return {
43
- log: _noop, // otherwise it is "log everything" logger (same logger as input)
47
+ debug: _noop, // otherwise it is "log everything" logger (same logger as input)
48
+ log: level <= commonLogLevelNumber['log'] ? logger.log.bind(logger) : _noop,
44
49
  warn: level <= commonLogLevelNumber['warn'] ? logger.warn.bind(logger) : _noop,
45
50
  error: logger.error.bind(logger), // otherwise it's "log nothing" logger (same as noopLogger)
46
51
  };
@@ -50,6 +55,7 @@ export function commonLoggerMinLevel(logger, minLevel, opt = {}) {
50
55
  */
51
56
  export function commonLoggerPipe(loggers) {
52
57
  return {
58
+ debug: (...args) => loggers.forEach(logger => logger.debug(...args)),
53
59
  log: (...args) => loggers.forEach(logger => logger.log(...args)),
54
60
  warn: (...args) => loggers.forEach(logger => logger.warn(...args)),
55
61
  error: (...args) => loggers.forEach(logger => logger.error(...args)),
@@ -60,6 +66,7 @@ export function commonLoggerPipe(loggers) {
60
66
  */
61
67
  export function commonLoggerPrefix(logger, ...prefixes) {
62
68
  return {
69
+ debug: (...args) => logger.debug(...prefixes, ...args),
63
70
  log: (...args) => logger.log(...prefixes, ...args),
64
71
  warn: (...args) => logger.warn(...prefixes, ...args),
65
72
  error: (...args) => logger.error(...prefixes, ...args),
@@ -70,6 +77,7 @@ export function commonLoggerPrefix(logger, ...prefixes) {
70
77
  */
71
78
  export function commonLoggerCreate(fn) {
72
79
  return {
80
+ debug: (...args) => fn('debug', args),
73
81
  log: (...args) => fn('log', args),
74
82
  warn: (...args) => fn('warn', args),
75
83
  error: (...args) => fn('error', args),
package/dist/types.d.ts CHANGED
@@ -114,10 +114,10 @@ export declare const SKIP: unique symbol;
114
114
  */
115
115
  export declare const MISS: unique symbol;
116
116
  /**
117
- * Function which is called for every item in `input`. Expected to return a `Promise` or value.
117
+ * Function which is called for every item in `input`. Expected to return a `Promise`.
118
118
  */
119
- export type AsyncMapper<IN = any, OUT = any> = (input: IN) => OUT | PromiseLike<OUT>;
120
- export type AsyncIndexedMapper<IN = any, OUT = any> = (input: IN, index: number) => OUT | PromiseLike<OUT>;
119
+ export type AsyncMapper<IN = any, OUT = any> = (input: IN) => PromiseLike<OUT>;
120
+ export type AsyncIndexedMapper<IN = any, OUT = any> = (input: IN, index: number) => PromiseLike<OUT>;
121
121
  export type Mapper<IN = any, OUT = any> = (input: IN) => OUT;
122
122
  export type IndexedMapper<IN = any, OUT = any> = (input: IN, index: number) => OUT;
123
123
  export declare const _passthroughMapper: IndexedMapper;
@@ -127,11 +127,11 @@ export declare const _passUndefinedMapper: IndexedMapper<any, void>;
127
127
  */
128
128
  export declare const _noop: (..._args: any[]) => undefined;
129
129
  export type Predicate<T> = (item: T, index: number) => boolean;
130
- export type AsyncPredicate<T> = (item: T, index: number) => boolean | PromiseLike<boolean>;
130
+ export type AsyncPredicate<T> = (item: T, index: number) => PromiseLike<boolean>;
131
131
  export type AbortablePredicate<T> = (item: T, i: number) => boolean | typeof END;
132
- export type AbortableAsyncPredicate<T> = (item: T, i: number) => Promisable<boolean | typeof END>;
132
+ export type AbortableAsyncPredicate<T> = (item: T, i: number) => PromiseLike<boolean | typeof END>;
133
133
  export type AbortableMapper<IN = any, OUT = any> = (input: IN, i: number) => OUT | typeof SKIP | typeof END;
134
- export type AbortableAsyncMapper<IN = any, OUT = any> = (input: IN, i: number) => Promisable<OUT | typeof SKIP | typeof END>;
134
+ export type AbortableAsyncMapper<IN = any, OUT = any> = (input: IN, i: number) => PromiseLike<OUT | typeof SKIP | typeof END>;
135
135
  export declare const _passthroughPredicate: Predicate<any>;
136
136
  export declare const _passNothingPredicate: Predicate<any>;
137
137
  export interface BatchResult<RES = any, ERR = Error> {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.31.0",
4
+ "version": "15.33.0",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "undici": "^7",
@@ -13,7 +13,7 @@
13
13
  "@types/semver": "^7",
14
14
  "crypto-js": "^4",
15
15
  "dayjs": "^1",
16
- "@naturalcycles/dev-lib": "18.4.2"
16
+ "@naturalcycles/dev-lib": "19.37.0"
17
17
  },
18
18
  "exports": {
19
19
  ".": "./dist/index.js",
@@ -1,4 +1,10 @@
1
- import type { AbortableAsyncMapper, AbortableAsyncPredicate, Promisable } from '../types.js'
1
+ import type {
2
+ AbortableAsyncMapper,
3
+ AbortableAsyncPredicate,
4
+ AbortableMapper,
5
+ AbortablePredicate,
6
+ Promisable,
7
+ } from '../types.js'
2
8
  import { END, SKIP } from '../types.js'
3
9
 
4
10
  /**
@@ -58,6 +64,10 @@ export class AsyncIterable2<T> implements AsyncIterable<T> {
58
64
  return !!(await this.find(cb))
59
65
  }
60
66
 
67
+ async someSync(cb: AbortablePredicate<T>): Promise<boolean> {
68
+ return !!(await this.findSync(cb))
69
+ }
70
+
61
71
  async every(cb: AbortableAsyncPredicate<T>): Promise<boolean> {
62
72
  let i = 0
63
73
  for await (const v of this.it) {
@@ -67,6 +77,15 @@ export class AsyncIterable2<T> implements AsyncIterable<T> {
67
77
  return true
68
78
  }
69
79
 
80
+ async everySync(cb: AbortablePredicate<T>): Promise<boolean> {
81
+ let i = 0
82
+ for await (const v of this.it) {
83
+ const r = cb(v, i++)
84
+ if (r === END || !r) return false
85
+ }
86
+ return true
87
+ }
88
+
70
89
  async find(cb: AbortableAsyncPredicate<T>): Promise<T | undefined> {
71
90
  let i = 0
72
91
  for await (const v of this.it) {
@@ -76,6 +95,15 @@ export class AsyncIterable2<T> implements AsyncIterable<T> {
76
95
  }
77
96
  }
78
97
 
98
+ async findSync(cb: AbortablePredicate<T>): Promise<T | undefined> {
99
+ let i = 0
100
+ for await (const v of this.it) {
101
+ const r = cb(v, i++)
102
+ if (r === END) return
103
+ if (r) return v
104
+ }
105
+ }
106
+
79
107
  filter(cb: AbortableAsyncPredicate<T>): AsyncIterable2<T> {
80
108
  const { it } = this
81
109
 
@@ -91,6 +119,21 @@ export class AsyncIterable2<T> implements AsyncIterable<T> {
91
119
  })
92
120
  }
93
121
 
122
+ filterSync(cb: AbortablePredicate<T>): AsyncIterable2<T> {
123
+ const { it } = this
124
+
125
+ return new AsyncIterable2<T>({
126
+ async *[Symbol.asyncIterator]() {
127
+ let i = 0
128
+ for await (const v of it) {
129
+ const r = cb(v, i++)
130
+ if (r === END) return
131
+ if (r) yield v
132
+ }
133
+ },
134
+ })
135
+ }
136
+
94
137
  map<OUT>(mapper: AbortableAsyncMapper<T, OUT>): AsyncIterable2<OUT> {
95
138
  const { it } = this
96
139
 
@@ -106,4 +149,20 @@ export class AsyncIterable2<T> implements AsyncIterable<T> {
106
149
  },
107
150
  })
108
151
  }
152
+
153
+ mapSync<OUT>(mapper: AbortableMapper<T, OUT>): AsyncIterable2<OUT> {
154
+ const { it } = this
155
+
156
+ return new AsyncIterable2<OUT>({
157
+ async *[Symbol.asyncIterator]() {
158
+ let i = 0
159
+ for await (const v of it) {
160
+ const r = mapper(v, i++)
161
+ if (r === END) return
162
+ if (r === SKIP) continue
163
+ yield r
164
+ }
165
+ },
166
+ })
167
+ }
109
168
  }
@@ -1,22 +1,27 @@
1
- // copy-pasted to avoid weird circular dependency
2
1
  import type { MutateOptions } from '../array/array.util.js'
3
2
 
3
+ // copy-pasted to avoid weird circular dependency
4
4
  const _noop = (..._args: any[]): undefined => undefined
5
5
 
6
6
  /**
7
7
  * These levels follow console.* naming,
8
8
  * so you can use console[level] safely.
9
9
  *
10
- * `log` is considered default level.
10
+ * `debug` is not enabled by default, and is useful when debugging is needed.
11
+ *
12
+ * `log` is considered default level, and is enabled by default.
11
13
  *
12
- * For simplicity - only these 3 levels are kept.
14
+ * `warn` is for warnings - things that are not super-severe to be an error, but should not happen
15
+ *
16
+ * `error` level would only log errors
13
17
  *
14
18
  * @experimental
15
19
  */
16
- export type CommonLogLevel = 'log' | 'warn' | 'error'
20
+ export type CommonLogLevel = 'debug' | 'log' | 'warn' | 'error'
17
21
 
18
22
  export const commonLogLevelNumber: Record<CommonLogLevel, number> = {
19
- log: 10,
23
+ debug: 10,
24
+ log: 20,
20
25
  warn: 20,
21
26
  error: 30,
22
27
  }
@@ -37,6 +42,7 @@ export type CommonLogWithLevelFunction = (level: CommonLogLevel, args: any[]) =>
37
42
  * @experimental
38
43
  */
39
44
  export interface CommonLogger {
45
+ debug: CommonLogFunction
40
46
  log: CommonLogFunction
41
47
  warn: CommonLogFunction
42
48
  error: CommonLogFunction
@@ -44,10 +50,9 @@ export interface CommonLogger {
44
50
 
45
51
  /**
46
52
  * SimpleLogger that does nothing (noop).
47
- *
48
- * @experimental
49
53
  */
50
54
  export const commonLoggerNoop: CommonLogger = {
55
+ debug: _noop,
51
56
  log: _noop,
52
57
  warn: _noop,
53
58
  error: _noop,
@@ -56,26 +61,29 @@ export const commonLoggerNoop: CommonLogger = {
56
61
  /**
57
62
  * Creates a "child" logger that is "limited" to the specified CommonLogLevel.
58
63
  */
59
- export function commonLoggerMinLevel(
60
- logger: CommonLogger,
61
- minLevel: CommonLogLevel,
64
+ export function createCommonLoggerAtLevel(
65
+ logger: CommonLogger = console,
66
+ minLevel: CommonLogLevel = 'log',
62
67
  opt: MutateOptions = {},
63
68
  ): CommonLogger {
64
69
  const level = commonLogLevelNumber[minLevel]
65
70
  if (opt.mutate) {
66
- if (level > commonLogLevelNumber['log']) {
67
- logger.log = _noop
68
- if (level > commonLogLevelNumber['warn']) {
69
- logger.warn = _noop
70
- if (level > commonLogLevelNumber['error']) {
71
- logger.error = _noop
71
+ if (level > commonLogLevelNumber['debug']) {
72
+ logger.debug = _noop
73
+ if (level > commonLogLevelNumber['log']) {
74
+ logger.log = _noop
75
+ if (level > commonLogLevelNumber['warn']) {
76
+ logger.warn = _noop
77
+ if (level > commonLogLevelNumber['error']) {
78
+ logger.error = _noop
79
+ }
72
80
  }
73
81
  }
74
82
  }
75
83
  return logger
76
84
  }
77
85
 
78
- if (level <= commonLogLevelNumber['log']) {
86
+ if (level <= commonLogLevelNumber['debug']) {
79
87
  // All levels are kept
80
88
  return logger
81
89
  }
@@ -86,7 +94,8 @@ export function commonLoggerMinLevel(
86
94
  }
87
95
 
88
96
  return {
89
- log: _noop, // otherwise it is "log everything" logger (same logger as input)
97
+ debug: _noop, // otherwise it is "log everything" logger (same logger as input)
98
+ log: level <= commonLogLevelNumber['log'] ? logger.log.bind(logger) : _noop,
90
99
  warn: level <= commonLogLevelNumber['warn'] ? logger.warn.bind(logger) : _noop,
91
100
  error: logger.error.bind(logger), // otherwise it's "log nothing" logger (same as noopLogger)
92
101
  }
@@ -97,6 +106,7 @@ export function commonLoggerMinLevel(
97
106
  */
98
107
  export function commonLoggerPipe(loggers: CommonLogger[]): CommonLogger {
99
108
  return {
109
+ debug: (...args) => loggers.forEach(logger => logger.debug(...args)),
100
110
  log: (...args) => loggers.forEach(logger => logger.log(...args)),
101
111
  warn: (...args) => loggers.forEach(logger => logger.warn(...args)),
102
112
  error: (...args) => loggers.forEach(logger => logger.error(...args)),
@@ -108,6 +118,7 @@ export function commonLoggerPipe(loggers: CommonLogger[]): CommonLogger {
108
118
  */
109
119
  export function commonLoggerPrefix(logger: CommonLogger, ...prefixes: any[]): CommonLogger {
110
120
  return {
121
+ debug: (...args) => logger.debug(...prefixes, ...args),
111
122
  log: (...args) => logger.log(...prefixes, ...args),
112
123
  warn: (...args) => logger.warn(...prefixes, ...args),
113
124
  error: (...args) => logger.error(...prefixes, ...args),
@@ -119,6 +130,7 @@ export function commonLoggerPrefix(logger: CommonLogger, ...prefixes: any[]): Co
119
130
  */
120
131
  export function commonLoggerCreate(fn: CommonLogWithLevelFunction): CommonLogger {
121
132
  return {
133
+ debug: (...args) => fn('debug', args),
122
134
  log: (...args) => fn('log', args),
123
135
  warn: (...args) => fn('warn', args),
124
136
  error: (...args) => fn('error', args),
package/src/types.ts CHANGED
@@ -141,13 +141,10 @@ export const SKIP = Symbol('SKIP')
141
141
  export const MISS = Symbol('MISS')
142
142
 
143
143
  /**
144
- * Function which is called for every item in `input`. Expected to return a `Promise` or value.
144
+ * Function which is called for every item in `input`. Expected to return a `Promise`.
145
145
  */
146
- export type AsyncMapper<IN = any, OUT = any> = (input: IN) => OUT | PromiseLike<OUT>
147
- export type AsyncIndexedMapper<IN = any, OUT = any> = (
148
- input: IN,
149
- index: number,
150
- ) => OUT | PromiseLike<OUT>
146
+ export type AsyncMapper<IN = any, OUT = any> = (input: IN) => PromiseLike<OUT>
147
+ export type AsyncIndexedMapper<IN = any, OUT = any> = (input: IN, index: number) => PromiseLike<OUT>
151
148
  export type Mapper<IN = any, OUT = any> = (input: IN) => OUT
152
149
  export type IndexedMapper<IN = any, OUT = any> = (input: IN, index: number) => OUT
153
150
 
@@ -160,10 +157,10 @@ export const _passUndefinedMapper: IndexedMapper<any, void> = () => undefined
160
157
  export const _noop = (..._args: any[]): undefined => undefined
161
158
 
162
159
  export type Predicate<T> = (item: T, index: number) => boolean
163
- export type AsyncPredicate<T> = (item: T, index: number) => boolean | PromiseLike<boolean>
160
+ export type AsyncPredicate<T> = (item: T, index: number) => PromiseLike<boolean>
164
161
 
165
162
  export type AbortablePredicate<T> = (item: T, i: number) => boolean | typeof END
166
- export type AbortableAsyncPredicate<T> = (item: T, i: number) => Promisable<boolean | typeof END>
163
+ export type AbortableAsyncPredicate<T> = (item: T, i: number) => PromiseLike<boolean | typeof END>
167
164
  export type AbortableMapper<IN = any, OUT = any> = (
168
165
  input: IN,
169
166
  i: number,
@@ -171,7 +168,7 @@ export type AbortableMapper<IN = any, OUT = any> = (
171
168
  export type AbortableAsyncMapper<IN = any, OUT = any> = (
172
169
  input: IN,
173
170
  i: number,
174
- ) => Promisable<OUT | typeof SKIP | typeof END>
171
+ ) => PromiseLike<OUT | typeof SKIP | typeof END>
175
172
 
176
173
  export const _passthroughPredicate: Predicate<any> = () => true
177
174
  export const _passNothingPredicate: Predicate<any> = () => false