@mtkruto/browser 0.128.0 → 0.129.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/esm/0_deps.d.ts +4 -3
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +4 -3
- package/esm/3_types.d.ts +3 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +3 -0
- package/esm/client/1_client_generic.d.ts +19 -1
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts +3 -0
- package/esm/client/2_account_manager.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +16 -1
- package/esm/client/6_client.d.ts +19 -1
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +24 -0
- package/esm/client/6_client_dispatcher.d.ts +19 -1
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +24 -0
- package/esm/types/0_calling_code.d.ts +27 -0
- package/esm/types/0_calling_code.d.ts.map +1 -0
- package/esm/types/0_calling_code.js +26 -0
- package/esm/types/0_timezone.d.ts +31 -0
- package/esm/types/0_timezone.d.ts.map +1 -0
- package/esm/types/0_timezone.js +26 -0
- package/esm/types/1_chat_p.d.ts +1 -1
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +1 -1
- package/esm/types/1_country.d.ts +30 -0
- package/esm/types/1_country.d.ts.map +1 -0
- package/esm/types/1_country.js +30 -0
- package/esm/types/2_user.d.ts +1 -1
- package/esm/types/2_user.d.ts.map +1 -1
- package/esm/types/2_user.js +2 -2
- package/package.json +1 -1
- package/script/0_deps.d.ts +4 -3
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +13 -12
- package/script/3_types.d.ts +3 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +3 -0
- package/script/client/1_client_generic.d.ts +19 -1
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts +3 -0
- package/script/client/2_account_manager.d.ts.map +1 -1
- package/script/client/2_account_manager.js +15 -0
- package/script/client/6_client.d.ts +19 -1
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +24 -0
- package/script/client/6_client_dispatcher.d.ts +19 -1
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +24 -0
- package/script/types/0_calling_code.d.ts +27 -0
- package/script/types/0_calling_code.d.ts.map +1 -0
- package/script/types/0_calling_code.js +29 -0
- package/script/types/0_timezone.d.ts +31 -0
- package/script/types/0_timezone.d.ts.map +1 -0
- package/script/types/0_timezone.js +29 -0
- package/script/types/1_chat_p.d.ts +1 -1
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +1 -1
- package/script/types/1_country.d.ts +30 -0
- package/script/types/1_country.d.ts.map +1 -0
- package/script/types/1_country.js +33 -0
- package/script/types/2_user.d.ts +1 -1
- package/script/types/2_user.d.ts.map +1 -1
- package/script/types/2_user.js +2 -2
- package/esm/deps/jsr.io/@std/async/1.2.0/_util.d.ts +0 -2
- package/esm/deps/jsr.io/@std/async/1.2.0/_util.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/_util.js +0 -6
- package/esm/deps/jsr.io/@std/async/1.2.0/abortable.d.ts +0 -107
- package/esm/deps/jsr.io/@std/async/1.2.0/abortable.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/abortable.js +0 -46
- package/esm/deps/jsr.io/@std/async/1.2.0/deadline.d.ts +0 -37
- package/esm/deps/jsr.io/@std/async/1.2.0/deadline.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/deadline.js +0 -41
- package/esm/deps/jsr.io/@std/async/1.2.0/debounce.d.ts +0 -44
- package/esm/deps/jsr.io/@std/async/1.2.0/debounce.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/debounce.js +0 -57
- package/esm/deps/jsr.io/@std/async/1.2.0/mod.d.ts +0 -22
- package/esm/deps/jsr.io/@std/async/1.2.0/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/mod.js +0 -23
- package/esm/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.d.ts +0 -111
- package/esm/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +0 -154
- package/esm/deps/jsr.io/@std/async/1.2.0/retry.d.ts +0 -155
- package/esm/deps/jsr.io/@std/async/1.2.0/retry.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/retry.js +0 -147
- package/esm/deps/jsr.io/@std/async/1.2.0/tee.d.ts +0 -43
- package/esm/deps/jsr.io/@std/async/1.2.0/tee.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/async/1.2.0/tee.js +0 -79
- package/script/deps/jsr.io/@std/async/1.2.0/_util.d.ts +0 -2
- package/script/deps/jsr.io/@std/async/1.2.0/_util.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/_util.js +0 -9
- package/script/deps/jsr.io/@std/async/1.2.0/abortable.d.ts +0 -107
- package/script/deps/jsr.io/@std/async/1.2.0/abortable.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/abortable.js +0 -49
- package/script/deps/jsr.io/@std/async/1.2.0/deadline.d.ts +0 -37
- package/script/deps/jsr.io/@std/async/1.2.0/deadline.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/deadline.js +0 -44
- package/script/deps/jsr.io/@std/async/1.2.0/debounce.d.ts +0 -44
- package/script/deps/jsr.io/@std/async/1.2.0/debounce.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/debounce.js +0 -60
- package/script/deps/jsr.io/@std/async/1.2.0/mod.d.ts +0 -22
- package/script/deps/jsr.io/@std/async/1.2.0/mod.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/mod.js +0 -39
- package/script/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.d.ts +0 -111
- package/script/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +0 -158
- package/script/deps/jsr.io/@std/async/1.2.0/retry.d.ts +0 -155
- package/script/deps/jsr.io/@std/async/1.2.0/retry.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/retry.js +0 -152
- package/script/deps/jsr.io/@std/async/1.2.0/tee.d.ts +0 -43
- package/script/deps/jsr.io/@std/async/1.2.0/tee.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/async/1.2.0/tee.js +0 -82
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
3
|
-
// This module is browser compatible.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.tee = tee;
|
|
6
|
-
class Queue {
|
|
7
|
-
#source;
|
|
8
|
-
#queue;
|
|
9
|
-
head;
|
|
10
|
-
done;
|
|
11
|
-
constructor(iterable) {
|
|
12
|
-
this.#source = iterable[Symbol.asyncIterator]();
|
|
13
|
-
this.#queue = {
|
|
14
|
-
value: undefined,
|
|
15
|
-
next: undefined,
|
|
16
|
-
};
|
|
17
|
-
this.head = this.#queue;
|
|
18
|
-
this.done = false;
|
|
19
|
-
}
|
|
20
|
-
async next() {
|
|
21
|
-
const result = await this.#source.next();
|
|
22
|
-
if (!result.done) {
|
|
23
|
-
const nextNode = {
|
|
24
|
-
value: result.value,
|
|
25
|
-
next: undefined,
|
|
26
|
-
};
|
|
27
|
-
this.#queue.next = nextNode;
|
|
28
|
-
this.#queue = nextNode;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
this.done = true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Branches the given async iterable into the `n` branches.
|
|
37
|
-
*
|
|
38
|
-
* @example Usage
|
|
39
|
-
* ```ts
|
|
40
|
-
* import { tee } from "@std/async/tee";
|
|
41
|
-
* import { assertEquals } from "@std/assert";
|
|
42
|
-
*
|
|
43
|
-
* const gen = async function* gen() {
|
|
44
|
-
* yield 1;
|
|
45
|
-
* yield 2;
|
|
46
|
-
* yield 3;
|
|
47
|
-
* };
|
|
48
|
-
*
|
|
49
|
-
* const [branch1, branch2] = tee(gen());
|
|
50
|
-
*
|
|
51
|
-
* const result1 = await Array.fromAsync(branch1);
|
|
52
|
-
* assertEquals(result1, [1, 2, 3]);
|
|
53
|
-
*
|
|
54
|
-
* const result2 = await Array.fromAsync(branch2);
|
|
55
|
-
* assertEquals(result2, [1, 2, 3]);
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* @typeParam T The type of the provided async iterable and the returned async iterables.
|
|
59
|
-
* @typeParam N The amount of branches to tee into.
|
|
60
|
-
* @param iterable The iterable to tee.
|
|
61
|
-
* @param n The amount of branches to tee into.
|
|
62
|
-
* @returns The tuple where each element is an async iterable.
|
|
63
|
-
*/
|
|
64
|
-
function tee(iterable, n = 2) {
|
|
65
|
-
const queue = new Queue(iterable);
|
|
66
|
-
async function* generator() {
|
|
67
|
-
let buffer = queue.head;
|
|
68
|
-
while (true) {
|
|
69
|
-
if (buffer.next) {
|
|
70
|
-
buffer = buffer.next;
|
|
71
|
-
yield buffer.value;
|
|
72
|
-
}
|
|
73
|
-
else if (queue.done) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
await queue.next();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return Array.from({ length: n }).map(() => generator());
|
|
82
|
-
}
|