@mark1russell7/collections 0.9.0 → 0.9.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/collections",
4
- "version": "0.9.0",
4
+ "version": "0.9.1",
5
5
  "description": "Collections with no dependencies: lists, maps, queues, a summary tree, channels, lazy operations and dependency graphs.",
6
6
  "keywords": [
7
7
  "collections",
@@ -27,6 +27,8 @@ import { asyncQueue, type AsyncQueue } from "./async-queue.js";
27
27
  *
28
28
  * The channels of Go are the model. This class gives send/receive operations
29
29
  * that can block until the other side is ready.
30
+ *
31
+ * @deprecated Import `Channel` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
30
32
  */
31
33
  export class Channel<T> {
32
34
  private queue: AsyncQueue<T>;
@@ -140,6 +142,8 @@ export class Channel<T> {
140
142
 
141
143
  /**
142
144
  * SelectCase represents a case in a select statement.
145
+ *
146
+ * @deprecated Import `SelectCase` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
143
147
  */
144
148
  export interface SelectCase<R> {
145
149
  channel: Channel<any>;
@@ -212,6 +216,8 @@ function firstOf(waits: readonly Wait[]): Promise<{ index: number; value: unknow
212
216
  * ch2.case((v) => `ch2: ${v}`),
213
217
  * timeout(1000).case(() => 'timeout')
214
218
  * )
219
+ *
220
+ * @deprecated Import `select` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
215
221
  */
216
222
  export async function select<R>(...cases: SelectCase<R>[]): Promise<R> {
217
223
  const { index, value } = await firstOf(
@@ -229,6 +235,8 @@ export async function select<R>(...cases: SelectCase<R>[]): Promise<R> {
229
235
  * dataChannel.case((v) => v),
230
236
  * timeout(5000).case(() => 'timeout!')
231
237
  * )
238
+ *
239
+ * @deprecated Import `timeout` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
232
240
  */
233
241
  export function timeout(ms: number): Channel<void> {
234
242
  const ch = new Channel<void>();
@@ -247,6 +255,8 @@ export function timeout(ms: number): Channel<void> {
247
255
  * for await (const t of tick) {
248
256
  * console.log('Tick:', t)
249
257
  * }
258
+ *
259
+ * @deprecated Import `ticker` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
250
260
  */
251
261
  export function ticker(ms: number): Channel<number> & { stop: () => void } {
252
262
  const ch = new Channel<number>(1);
@@ -273,6 +283,8 @@ export function ticker(ms: number): Channel<number> & { stop: () => void } {
273
283
  *
274
284
  * await input.send(5)
275
285
  * const result = await output.receive() // 10
286
+ *
287
+ * @deprecated Import `pipeline` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
276
288
  */
277
289
  export function pipeline<T, U>(
278
290
  input: Channel<T>,
@@ -305,6 +317,8 @@ export function pipeline<T, U>(
305
317
  * const [out1, out2, out3] = fanOut(input, 3)
306
318
  *
307
319
  * // Each output gets a copy of every input value
320
+ *
321
+ * @deprecated Import `fanOut` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
308
322
  */
309
323
  export function fanOut<T>(input: Channel<T>, count: number, bufferSize: number = 0): Channel<T>[] {
310
324
  const outputs = Array.from({ length: count }, () => new Channel<T>(bufferSize));
@@ -331,6 +345,8 @@ export function fanOut<T>(input: Channel<T>, count: number, bufferSize: number =
331
345
  * const merged = fanIn(ch1, ch2)
332
346
  *
333
347
  * // merged receives values from both ch1 and ch2
348
+ *
349
+ * @deprecated Import `fanIn` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
334
350
  */
335
351
  export function fanIn<T>(...inputs: Channel<T>[]): Channel<T> {
336
352
  const output = new Channel<T>();
@@ -356,6 +372,8 @@ export function fanIn<T>(...inputs: Channel<T>[]): Channel<T> {
356
372
  * It takes one value at a time, from the inputs in turn. It keeps no receive on an input while
357
373
  * it waits for the reader of the output. Thus each value of each input reaches the output one
358
374
  * time, in the order of its input, or stays in its input.
375
+ *
376
+ * @deprecated Import `merge` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
359
377
  */
360
378
  export function merge<T>(...inputs: Channel<T>[]): Channel<T> {
361
379
  const output = new Channel<T>();
@@ -389,6 +407,8 @@ export function merge<T>(...inputs: Channel<T>[]): Channel<T> {
389
407
 
390
408
  /**
391
409
  * Buffered channel with specified capacity.
410
+ *
411
+ * @deprecated Import `buffered` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
392
412
  */
393
413
  export function buffered<T>(capacity: number): Channel<T> {
394
414
  return new Channel<T>(capacity);
@@ -397,6 +417,8 @@ export function buffered<T>(capacity: number): Channel<T> {
397
417
  /**
398
418
  * Unbuffered channel (rendezvous point).
399
419
  * Sends block until receiver is ready.
420
+ *
421
+ * @deprecated Import `unbuffered` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
400
422
  */
401
423
  export function unbuffered<T>(): Channel<T> {
402
424
  return new Channel<T>(0);
@@ -408,6 +430,8 @@ export function unbuffered<T>(): Channel<T> {
408
430
  * @example
409
431
  * const ch = channel<number>()
410
432
  * const bufferedCh = channel<string>(10)
433
+ *
434
+ * @deprecated Import `channel` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
411
435
  */
412
436
  export function channel<T>(bufferSize: number = 0): Channel<T> {
413
437
  return new Channel<T>(bufferSize);
@@ -424,6 +448,8 @@ export function channel<T>(bufferSize: number = 0): Channel<T> {
424
448
  * )
425
449
  *
426
450
  * // 4 workers concurrently process jobs from jobChannel
451
+ *
452
+ * @deprecated Import `workerPool` from `@mark1russell7/service/channel`. The next MINOR version of collections removes it.
427
453
  */
428
454
  export function workerPool<T, R>(
429
455
  jobs: Channel<T>,