@naturalcycles/nodejs-lib 15.0.0 → 15.1.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, Mapper } from '@naturalcycles/js-lib';
1
+ import type { AbortableAsyncMapper, IndexedMapper } from '@naturalcycles/js-lib';
2
2
  import type { ReadableTyped } from '../index.js';
3
3
  import type { TransformMapOptions } from '../transform/transformMap.js';
4
4
  /**
@@ -16,4 +16,4 @@ export declare function readableForEach<T>(readable: ReadableTyped<T>, mapper: A
16
16
  *
17
17
  * @experimental
18
18
  */
19
- export declare function readableForEachSync<T>(readable: ReadableTyped<T>, mapper: Mapper<T, void>): Promise<void>;
19
+ export declare function readableForEachSync<T>(readable: ReadableTyped<T>, mapper: IndexedMapper<T, void>): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { CommonLogger, Mapper } from '@naturalcycles/js-lib';
1
+ import type { CommonLogger, IndexedMapper } from '@naturalcycles/js-lib';
2
2
  import { ErrorMode } from '@naturalcycles/js-lib';
3
3
  import type { TransformTyped } from '../stream.model.js';
4
4
  export interface TransformMapSimpleOptions {
@@ -19,4 +19,4 @@ export interface TransformMapSimpleOptions {
19
19
  * Sync (not async) version of transformMap.
20
20
  * Supposedly faster, for cases when async is not needed.
21
21
  */
22
- export declare function transformMapSimple<IN = any, OUT = IN>(mapper: Mapper<IN, OUT>, opt?: TransformMapSimpleOptions): TransformTyped<IN, OUT>;
22
+ export declare function transformMapSimple<IN = any, OUT = IN>(mapper: IndexedMapper<IN, OUT>, opt?: TransformMapSimpleOptions): TransformTyped<IN, OUT>;
@@ -1,4 +1,4 @@
1
- import type { CommonLogger, Mapper, Predicate } from '@naturalcycles/js-lib';
1
+ import type { CommonLogger, IndexedMapper, Predicate } from '@naturalcycles/js-lib';
2
2
  import { END, ErrorMode, SKIP } from '@naturalcycles/js-lib';
3
3
  import { AbortableTransform } from '../pipeline/pipeline.js';
4
4
  import type { TransformTyped } from '../stream.model.js';
@@ -55,4 +55,4 @@ export declare class TransformMapSync extends AbortableTransform {
55
55
  * Sync (not async) version of transformMap.
56
56
  * Supposedly faster, for cases when async is not needed.
57
57
  */
58
- export declare function transformMapSync<IN = any, OUT = IN>(mapper: Mapper<IN, OUT | typeof SKIP | typeof END>, opt?: TransformMapSyncOptions): TransformTyped<IN, OUT>;
58
+ export declare function transformMapSync<IN = any, OUT = IN>(mapper: IndexedMapper<IN, OUT | typeof SKIP | typeof END>, opt?: TransformMapSyncOptions): TransformTyped<IN, OUT>;
@@ -1,4 +1,4 @@
1
- import type { AsyncMapper, CommonLogger } from '@naturalcycles/js-lib';
1
+ import type { AsyncIndexedMapper, CommonLogger } from '@naturalcycles/js-lib';
2
2
  import type { TransformOptions, TransformTyped } from '../stream.model.js';
3
3
  export interface TransformTapOptions extends TransformOptions {
4
4
  logger?: CommonLogger;
@@ -9,4 +9,4 @@ export interface TransformTapOptions extends TransformOptions {
9
9
  *
10
10
  * Can also act as a counter, since `index` is passed to `fn`
11
11
  */
12
- export declare function transformTap<IN>(fn: AsyncMapper<IN, any>, opt?: TransformTapOptions): TransformTyped<IN, IN>;
12
+ export declare function transformTap<IN>(fn: AsyncIndexedMapper<IN, any>, opt?: TransformTapOptions): TransformTyped<IN, IN>;
@@ -1,11 +1,11 @@
1
- import type { AsyncMapper, Mapper } from '@naturalcycles/js-lib';
1
+ import type { AsyncIndexedMapper, IndexedMapper } from '@naturalcycles/js-lib';
2
2
  import type { TransformMapOptions } from '../index.js';
3
3
  import type { WritableTyped } from '../stream.model.js';
4
4
  /**
5
5
  * Just an alias to transformMap that declares OUT as void.
6
6
  */
7
- export declare function writableForEach<IN = any>(mapper: AsyncMapper<IN, void>, opt?: TransformMapOptions<IN, void>): WritableTyped<IN>;
7
+ export declare function writableForEach<IN = any>(mapper: AsyncIndexedMapper<IN, void>, opt?: TransformMapOptions<IN, void>): WritableTyped<IN>;
8
8
  /**
9
9
  * Just an alias to transformMap that declares OUT as void.
10
10
  */
11
- export declare function writableForEachSync<IN = any>(mapper: Mapper<IN, void>, opt?: TransformMapOptions<IN, void>): WritableTyped<IN>;
11
+ export declare function writableForEachSync<IN = any>(mapper: IndexedMapper<IN, void>, opt?: TransformMapOptions<IN, void>): WritableTyped<IN>;
@@ -24,7 +24,3 @@ export declare const inspectStringifyFn: JsonStringifyFunction;
24
24
  * Based on `_stringify` from `js-lib`, just replaced `JSON.stringify` with `util.inspect`.
25
25
  */
26
26
  export declare function _inspect(obj: any, opt?: InspectAnyOptions): string;
27
- /**
28
- * @deprecated renamed to _inspect
29
- */
30
- export declare const inspectAny: typeof _inspect;
@@ -41,7 +41,3 @@ export function _inspect(obj, opt = {}) {
41
41
  }),
42
42
  });
43
43
  }
44
- /**
45
- * @deprecated renamed to _inspect
46
- */
47
- export const inspectAny = _inspect;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "15.0.0",
4
+ "version": "15.1.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@types/js-yaml": "^4",
@@ -1,4 +1,4 @@
1
- import type { AbortableAsyncMapper, Mapper } from '@naturalcycles/js-lib'
1
+ import type { AbortableAsyncMapper, IndexedMapper } from '@naturalcycles/js-lib'
2
2
  import { _passNothingPredicate } from '@naturalcycles/js-lib'
3
3
  import type { ReadableTyped } from '../index.js'
4
4
  import { _pipeline } from '../index.js'
@@ -32,7 +32,7 @@ export async function readableForEach<T>(
32
32
  */
33
33
  export async function readableForEachSync<T>(
34
34
  readable: ReadableTyped<T>,
35
- mapper: Mapper<T, void>,
35
+ mapper: IndexedMapper<T, void>,
36
36
  ): Promise<void> {
37
37
  // async iteration
38
38
  let index = 0
@@ -1,5 +1,5 @@
1
1
  import { Transform } from 'node:stream'
2
- import type { CommonLogger, Mapper } from '@naturalcycles/js-lib'
2
+ import type { CommonLogger, IndexedMapper } from '@naturalcycles/js-lib'
3
3
  import { ErrorMode } from '@naturalcycles/js-lib'
4
4
  import type { TransformTyped } from '../stream.model.js'
5
5
 
@@ -24,7 +24,7 @@ export interface TransformMapSimpleOptions {
24
24
  * Supposedly faster, for cases when async is not needed.
25
25
  */
26
26
  export function transformMapSimple<IN = any, OUT = IN>(
27
- mapper: Mapper<IN, OUT>,
27
+ mapper: IndexedMapper<IN, OUT>,
28
28
  opt: TransformMapSimpleOptions = {},
29
29
  ): TransformTyped<IN, OUT> {
30
30
  let index = -1
@@ -1,4 +1,9 @@
1
- import type { CommonLogger, Mapper, Predicate, UnixTimestampMillis } from '@naturalcycles/js-lib'
1
+ import type {
2
+ CommonLogger,
3
+ IndexedMapper,
4
+ Predicate,
5
+ UnixTimestampMillis,
6
+ } from '@naturalcycles/js-lib'
2
7
  import { _anyToError, END, ErrorMode, SKIP } from '@naturalcycles/js-lib'
3
8
  import { yellow } from '../../colors/colors.js'
4
9
  import { AbortableTransform } from '../pipeline/pipeline.js'
@@ -67,7 +72,7 @@ export class TransformMapSync extends AbortableTransform {}
67
72
  * Supposedly faster, for cases when async is not needed.
68
73
  */
69
74
  export function transformMapSync<IN = any, OUT = IN>(
70
- mapper: Mapper<IN, OUT | typeof SKIP | typeof END>,
75
+ mapper: IndexedMapper<IN, OUT | typeof SKIP | typeof END>,
71
76
  opt: TransformMapSyncOptions = {},
72
77
  ): TransformTyped<IN, OUT> {
73
78
  const {
@@ -1,5 +1,5 @@
1
1
  import { Transform } from 'node:stream'
2
- import type { AsyncMapper, CommonLogger } from '@naturalcycles/js-lib'
2
+ import type { AsyncIndexedMapper, CommonLogger } from '@naturalcycles/js-lib'
3
3
  import type { TransformOptions, TransformTyped } from '../stream.model.js'
4
4
 
5
5
  export interface TransformTapOptions extends TransformOptions {
@@ -13,7 +13,7 @@ export interface TransformTapOptions extends TransformOptions {
13
13
  * Can also act as a counter, since `index` is passed to `fn`
14
14
  */
15
15
  export function transformTap<IN>(
16
- fn: AsyncMapper<IN, any>,
16
+ fn: AsyncIndexedMapper<IN, any>,
17
17
  opt: TransformTapOptions = {},
18
18
  ): TransformTyped<IN, IN> {
19
19
  const { logger = console } = opt
@@ -1,4 +1,4 @@
1
- import type { AsyncMapper, Mapper } from '@naturalcycles/js-lib'
1
+ import type { AsyncIndexedMapper, IndexedMapper } from '@naturalcycles/js-lib'
2
2
  import { _passNothingPredicate } from '@naturalcycles/js-lib'
3
3
  import type { TransformMapOptions } from '../index.js'
4
4
  import { transformMap, transformMapSync } from '../index.js'
@@ -8,7 +8,7 @@ import type { WritableTyped } from '../stream.model.js'
8
8
  * Just an alias to transformMap that declares OUT as void.
9
9
  */
10
10
  export function writableForEach<IN = any>(
11
- mapper: AsyncMapper<IN, void>,
11
+ mapper: AsyncIndexedMapper<IN, void>,
12
12
  opt: TransformMapOptions<IN, void> = {},
13
13
  ): WritableTyped<IN> {
14
14
  return transformMap<IN, void>(mapper, { ...opt, predicate: _passNothingPredicate })
@@ -18,7 +18,7 @@ export function writableForEach<IN = any>(
18
18
  * Just an alias to transformMap that declares OUT as void.
19
19
  */
20
20
  export function writableForEachSync<IN = any>(
21
- mapper: Mapper<IN, void>,
21
+ mapper: IndexedMapper<IN, void>,
22
22
  opt: TransformMapOptions<IN, void> = {},
23
23
  ): WritableTyped<IN> {
24
24
  return transformMapSync<IN, void>(mapper, { ...opt, predicate: _passNothingPredicate })
@@ -50,8 +50,3 @@ export function _inspect(obj: any, opt: InspectAnyOptions = {}): string {
50
50
  }),
51
51
  })
52
52
  }
53
-
54
- /**
55
- * @deprecated renamed to _inspect
56
- */
57
- export const inspectAny = _inspect