@oazmi/superbuild 0.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.
Files changed (118) hide show
  1. package/esm/_dnt.shims.d.ts +2 -0
  2. package/esm/_dnt.shims.d.ts.map +1 -0
  3. package/esm/_dnt.shims.js +57 -0
  4. package/esm/deps/jsr.io/@oazmi/esbuild-types/0.28.0/src/mod.d.ts +598 -0
  5. package/esm/deps/jsr.io/@oazmi/esbuild-types/0.28.0/src/mod.d.ts.map +1 -0
  6. package/esm/deps/jsr.io/@oazmi/esbuild-types/0.28.0/src/mod.js +1 -0
  7. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/alias.d.ts +617 -0
  8. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/alias.d.ts.map +1 -0
  9. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/alias.js +671 -0
  10. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array1d.d.ts +487 -0
  11. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array1d.d.ts.map +1 -0
  12. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array1d.js +536 -0
  13. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array2d.d.ts +266 -0
  14. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array2d.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array2d.js +318 -0
  16. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/binder.d.ts +368 -0
  17. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/binder.d.ts.map +1 -0
  18. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/binder.js +380 -0
  19. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/crossenv.d.ts +711 -0
  20. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/crossenv.d.ts.map +1 -0
  21. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/crossenv.js +1173 -0
  22. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/cryptoman.d.ts +171 -0
  23. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/cryptoman.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/cryptoman.js +308 -0
  25. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/deps.d.ts +10 -0
  26. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/deps.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/deps.js +10 -0
  28. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack.d.ts +168 -0
  29. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack.d.ts.map +1 -0
  30. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack.js +236 -0
  31. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack_varint.d.ts +90 -0
  32. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack_varint.d.ts.map +1 -0
  33. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/eightpack_varint.js +237 -0
  34. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericarray.d.ts +213 -0
  35. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericarray.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericarray.js +363 -0
  37. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericmethods.d.ts +233 -0
  38. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericmethods.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/numericmethods.js +256 -0
  40. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/pathman.d.ts +1436 -0
  41. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/pathman.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/pathman.js +1730 -0
  43. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/promiseman.d.ts +647 -0
  44. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/promiseman.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/promiseman.js +762 -0
  46. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/stringman.d.ts +538 -0
  47. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/stringman.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/stringman.js +626 -0
  49. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/struct.d.ts +734 -0
  50. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/struct.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/struct.js +764 -0
  52. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedbuffer.d.ts +137 -0
  53. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedbuffer.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedbuffer.js +234 -0
  55. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedefs.d.ts +391 -0
  56. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedefs.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/typedefs.js +8 -0
  58. package/esm/deps.d.ts +56 -0
  59. package/esm/deps.d.ts.map +1 -0
  60. package/esm/deps.js +37 -0
  61. package/esm/esbuild/metafile.d.ts +90 -0
  62. package/esm/esbuild/metafile.d.ts.map +1 -0
  63. package/esm/esbuild/metafile.js +275 -0
  64. package/esm/esbuild/native.d.ts +95 -0
  65. package/esm/esbuild/native.d.ts.map +1 -0
  66. package/esm/esbuild/native.js +127 -0
  67. package/esm/esbuild/outputfile.d.ts +86 -0
  68. package/esm/esbuild/outputfile.d.ts.map +1 -0
  69. package/esm/esbuild/outputfile.js +221 -0
  70. package/esm/esbuild/strongtypes.d.ts +90 -0
  71. package/esm/esbuild/strongtypes.d.ts.map +1 -0
  72. package/esm/esbuild/strongtypes.js +8 -0
  73. package/esm/esbuild/typedefs.d.ts +121 -0
  74. package/esm/esbuild/typedefs.d.ts.map +1 -0
  75. package/esm/esbuild/typedefs.js +55 -0
  76. package/esm/esbuild/weaktypes.d.ts +46 -0
  77. package/esm/esbuild/weaktypes.d.ts.map +1 -0
  78. package/esm/esbuild/weaktypes.js +8 -0
  79. package/esm/funcdefs.d.ts +89 -0
  80. package/esm/funcdefs.d.ts.map +1 -0
  81. package/esm/funcdefs.js +145 -0
  82. package/esm/mod.d.ts +4 -0
  83. package/esm/mod.d.ts.map +1 -0
  84. package/esm/mod.js +2 -0
  85. package/esm/package.json +3 -0
  86. package/esm/plugins/emissions_driver.d.ts +33 -0
  87. package/esm/plugins/emissions_driver.d.ts.map +1 -0
  88. package/esm/plugins/emissions_driver.js +260 -0
  89. package/esm/plugins/long_build.d.ts +138 -0
  90. package/esm/plugins/long_build.d.ts.map +1 -0
  91. package/esm/plugins/long_build.js +288 -0
  92. package/esm/plugins/native_replica.d.ts +48 -0
  93. package/esm/plugins/native_replica.d.ts.map +1 -0
  94. package/esm/plugins/native_replica.js +122 -0
  95. package/esm/super/build.d.ts +53 -0
  96. package/esm/super/build.d.ts.map +1 -0
  97. package/esm/super/build.js +39 -0
  98. package/esm/super/build_context.d.ts +83 -0
  99. package/esm/super/build_context.d.ts.map +1 -0
  100. package/esm/super/build_context.js +124 -0
  101. package/esm/super/mod.d.ts +12 -0
  102. package/esm/super/mod.d.ts.map +1 -0
  103. package/esm/super/mod.js +9 -0
  104. package/esm/super/plugin.d.ts +23 -0
  105. package/esm/super/plugin.d.ts.map +1 -0
  106. package/esm/super/plugin.js +31 -0
  107. package/esm/super/plugin_build.d.ts +38 -0
  108. package/esm/super/plugin_build.d.ts.map +1 -0
  109. package/esm/super/plugin_build.js +198 -0
  110. package/esm/super/typedefs.d.ts +323 -0
  111. package/esm/super/typedefs.d.ts.map +1 -0
  112. package/esm/super/typedefs.js +10 -0
  113. package/esm/typedefs.d.ts +21 -0
  114. package/esm/typedefs.d.ts.map +1 -0
  115. package/esm/typedefs.js +5 -0
  116. package/license.md +37 -0
  117. package/package.json +88 -0
  118. package/readme.md +181 -0
@@ -0,0 +1,487 @@
1
+ /** utility functions for 1d arrays.
2
+ *
3
+ * @module
4
+ */
5
+ /** resolve the positive (normalized) starting and ending indexes of a range.
6
+ *
7
+ * for both `start` and `end`, a negative index can be used to indicate an index from the end of the range, if a `length` is given.
8
+ * for example, `-2` refers to the second to last index (ie `length - 2`).
9
+ *
10
+ * > [!note]
11
+ * > you **must** provide the length of your array if you wish to use negative indexes.
12
+ * > furthermore, you will **only** receive the length property if you had initially provided the length of the array.
13
+ *
14
+ * @param start starting index. defaults to `0`
15
+ * @param end ending index. defaults to `undefined` if `length` is not provided. else `end = length` (before offsetting)
16
+ * @param length length of the array in question. required if you want a numeric value of `end` that is `undefined`. defaults to `undefined`
17
+ * @param offset in the very end of evauation, add an addition offset to `start` and `end` indexes
18
+ * @returns a 3-tuple array of resolved [`start` index, `end` index, and `length` of range (ie `end - start`)]
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { assertEquals } from "jsr:@std/assert"
23
+ *
24
+ * const
25
+ * my_array = [0, 1, 2, 3, 4, 5, 6],
26
+ * [start, end, new_length] = resolveRange(1, -2, my_array.length)
27
+ *
28
+ * assertEquals([start, end, new_length], [1, 5, 4])
29
+ * assertEquals(my_array.slice(start, end), [1, 2, 3, 4])
30
+ *
31
+ * // expected resolved ranges when a length (3rd argument) is given.
32
+ * assertEquals(resolveRange(2, undefined, 10), [2, 10, 8])
33
+ * assertEquals(resolveRange(2, 10, 10), [2, 10, 8])
34
+ * assertEquals(resolveRange(2, -1, 10), [2, 9, 7])
35
+ * assertEquals(resolveRange(2, -2, 10), [2, 8, 6])
36
+ * assertEquals(resolveRange(undefined, -2, 10), [0, 8, 8])
37
+ * assertEquals(resolveRange(-3, undefined, 10), [7, 10, 3])
38
+ * assertEquals(resolveRange(-3, -1, 10), [7, 9, 2])
39
+ *
40
+ * // if no length argument is provided, then no expectation for output length will be given.
41
+ * assertEquals(resolveRange(2, 10), [2, 10, undefined])
42
+ * assertEquals(resolveRange(2), [2, undefined, undefined])
43
+ *
44
+ * // if no length argument is provided, negative indexes will not be resolved.
45
+ * assertEquals(resolveRange(-2, 10), [-2, 10, undefined])
46
+ * assertEquals(resolveRange(2, -2), [2, -2, undefined])
47
+ * assertEquals(resolveRange(-2, -2), [-2, -2, undefined])
48
+ *
49
+ * // you can additionally offset you final resolved output `start` and `end` indexes using the optional 4th `offset` argument.
50
+ * assertEquals(resolveRange(2, undefined, 10, 100), [102, 110, 8])
51
+ * assertEquals(resolveRange(2, 10, 10, 100), [102, 110, 8])
52
+ * assertEquals(resolveRange(2, -1, 10, 100), [102, 109, 7])
53
+ * assertEquals(resolveRange(2, -2, 10, 100), [102, 108, 6])
54
+ * assertEquals(resolveRange(undefined, -2, 10, 100), [100, 108, 8])
55
+ * assertEquals(resolveRange(-3, undefined, 10, 100), [107, 110, 3])
56
+ * assertEquals(resolveRange(-3, -1, 10, 100), [107, 109, 2])
57
+ *
58
+ * // expected resolved output when a length is not provided, but an offset is provided.
59
+ * assertEquals(resolveRange(2, 10, undefined, 100), [102, 110, undefined])
60
+ * assertEquals(resolveRange(2, undefined, undefined, 100), [102, undefined, undefined])
61
+ * // notice the `98`s below when negative indexes are used.
62
+ * // these might not be what one would expect, so always make sure to provide a length if a potential negative index might be used.
63
+ * assertEquals(resolveRange(-2, 10, undefined, 100), [98, 110, undefined])
64
+ * assertEquals(resolveRange(2, -2, undefined, 100), [102, 98, undefined])
65
+ * assertEquals(resolveRange(-2, -2, undefined, 100), [98, 98, undefined])
66
+ * ```
67
+ */
68
+ export declare function resolveRange(start: number | undefined, end: number | undefined, length: number, offset?: number): [start: number, end: number, length: number];
69
+ export declare function resolveRange(start?: number | undefined, end?: number | undefined, length?: undefined, offset?: number): [start: number, end: number | undefined, length: undefined];
70
+ /** mutate and rotate the given array by the specified amount to the right.
71
+ *
72
+ * given an array `arr`, this function would rotate its rows by the specified `amount`.
73
+ * a positive `amount` would rotate the rows to the right, and a negative `amount` would rotate it to the left.
74
+ *
75
+ * @param arr the array to be rotated.
76
+ * @param amount The number of indexes to rotate the major-axis to the right.
77
+ * positive values rotate right, while negative values rotate left.
78
+ * @returns The original array is returned back after the rotation.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import { assertEquals } from "jsr:@std/assert"
83
+ *
84
+ * const arr: Array<number> = [1, 2, 3, 4, 5]
85
+ *
86
+ * rotateArray(arr, 2)
87
+ * assertEquals(arr, [4, 5, 1, 2, 3])
88
+ *
89
+ * rotateArray(arr, -3)
90
+ * assertEquals(arr, [2, 3, 4, 5, 1])
91
+ * ```
92
+ */
93
+ export declare const rotateArray: <T>(arr: Array<T>, amount: number) => Array<T>;
94
+ /** shuffle a 1D array via mutation. the ordering of elements will be randomized by the end.
95
+ *
96
+ * ```ts
97
+ * import { assertEquals, assertNotEquals } from "jsr:@std/assert"
98
+ *
99
+ * const
100
+ * range_100 = Array(100).fill(0).map((_, i) => (i)), // sequntially numbered array
101
+ * my_arr = range_100.slice()
102
+ * shuffleArray(my_arr) // shuffling our array via mutation
103
+ *
104
+ * // the shuffled array is very unlikely to equal to the original unshuffled form
105
+ * assertNotEquals(my_arr, range_100)
106
+ * // sort the shuffled array to assert the preservation of the contained items
107
+ * assertEquals(my_arr.toSorted((a, b) => (a - b)), range_100)
108
+ * ```
109
+ */
110
+ export declare const shuffleArray: <T>(arr: Array<T>) => Array<T>;
111
+ /** a generator that shuffles your 1D array via mutation, then yields randomly selected non-repeating elements out of it, one by one,
112
+ * until all elements have been yielded, at which a new cycle begins, and the items in the array are re-shuffled again.
113
+ * i.e. after every new cycle, the ordering of the randomly yielded elements will differ from the ordering of the previous cycle.
114
+ *
115
+ * moreover, you can call the iterator with an optional number argument that specifies if you wish to skip ahead or go back a certain number of elements.
116
+ * - `1`: go to next element (default behavior)
117
+ * - `0`: receive the same element as before
118
+ * - `-1`: go to previous next element
119
+ * - `+ve number`: skip to next `number` of elements
120
+ * - `-ve number`: go back `number` of elements
121
+ *
122
+ * note that once a cycle is complete, going back won't restore the correct element from the previous cycle, because the info about the previous cycle gets lost.
123
+ *
124
+ * ```ts
125
+ * import { assert, assertEquals, assertNotEquals } from "jsr:@std/assert"
126
+ *
127
+ * const
128
+ * my_playlist = ["song1", "song2", "song3", "song4"],
129
+ * my_queue = my_playlist.slice(),
130
+ * track_iter = shuffledDeque(my_queue) // shuffles our play queue via mutation, and then indefinitely provides unique items each cycle
131
+ *
132
+ * const
133
+ * track1 = track_iter.next().value,
134
+ * track2 = track_iter.next(1).value,
135
+ * track3 = track_iter.next().value
136
+ *
137
+ * assertEquals(track1, track_iter.next(-2).value)
138
+ * assertEquals(track2, track_iter.next(1).value)
139
+ * assertEquals(track3, track_iter.next().value)
140
+ *
141
+ * const track4 = track_iter.next().value // final track of the current queue
142
+ * const track5 = track_iter.next().value // the queue has been reset, and re-shuffled
143
+ *
144
+ * assert([track1, track2, track3].includes(track4) === false)
145
+ * assert([track1, track2, track3, track4].includes(track5) === true)
146
+ * ```
147
+ */
148
+ export declare const shuffledDeque: <T>(arr: Array<T>) => Generator<T, void, number | undefined>;
149
+ /** type definition for a generic stack data structure, that is aware of its size. */
150
+ export interface GenericStack<T> {
151
+ readonly length: number;
152
+ push: (...items: T[]) => any;
153
+ pop: () => T | undefined;
154
+ }
155
+ /** a function to splice any stack (see the {@link GenericStack} interface).
156
+ *
157
+ * splicing alone lets you effectively implement all sorts of array mutation methods, such as
158
+ * `push`, `pop`, `unshift`, `shift`, `insert`, `rotate`, and many more.
159
+ *
160
+ * > [!note]
161
+ * > the `length` property of your `stack` is not mutated/assigned by this function.
162
+ * > you will have to do that manually yourself if your `stack` does not modify the `length` property upon the `push` and `pop` operations.
163
+ *
164
+ * @param stack the generic stack object to splice.
165
+ * @param start the starting index to begin splicing from.
166
+ * you must provide only positive starting index values.
167
+ * defaults to `0`.
168
+ * @param deleteCount the number of elements to remove from the `start` index (inclusive).
169
+ * if it is set to `undefined`, then all elements until the end of the generic stack array will be removed.
170
+ * defaults to `undefined`.
171
+ * @param items insert items at the `start` index, so that the first inserted item will occupy the `start` index _after_ the splicing.
172
+ * @returns an array of deleted items in the generic stack will be returned.
173
+ *
174
+ * @example
175
+ * ```ts
176
+ * import { assertEquals } from "jsr:@std/assert"
177
+ *
178
+ * // aliasing our functions for brevity
179
+ * const
180
+ * fn = spliceGenericStack,
181
+ * eq = assertEquals
182
+ *
183
+ * const my_stack = [0, 1, 2, 3, 4, 5, 6, 7]
184
+ *
185
+ * eq(fn(my_stack, 4), [4, 5, 6, 7])
186
+ * eq(my_stack, [0, 1, 2, 3])
187
+ *
188
+ * eq(fn(my_stack, 0, 0, -3, -2, -1), [])
189
+ * eq(my_stack, [-3, -2, -1, 0, 1, 2, 3])
190
+ *
191
+ * eq(fn(my_stack, 4, 2, 0.1, 0.2, 0.3), [1, 2])
192
+ * eq(my_stack, [-3, -2, -1, 0, 0.1, 0.2, 0.3, 3])
193
+ *
194
+ * eq(fn(my_stack), [-3, -2, -1, 0, 0.1, 0.2, 0.3, 3])
195
+ * eq(my_stack, [])
196
+ * ```
197
+ */
198
+ export declare const spliceGenericStack: <T>(stack: GenericStack<T>, start?: number, deleteCount?: number | undefined, ...items: T[]) => T[];
199
+ /** generate a numeric array with sequentially increasing value, within a specific range interval.
200
+ * similar to python's `range` function.
201
+ *
202
+ * however, unlike python's `range`, you **must** always supply the starting index **and** the ending index,
203
+ * even if the start index is supposed to be `0`, you cannot substitute the first argument with the ending index.
204
+ * only the {@link step} argument is optional. moreover, the {@link step} argument must always be a positive number.
205
+ *
206
+ * > [!note]
207
+ * > there is also an iterator generator variant of this function that is also capable of indefinite sequences.
208
+ * > check out {@link rangeIterator} for details.
209
+ *
210
+ * @param start the initial number to begin the output range sequence from.
211
+ * @param end the final exclusive number to end the output range sequence at. its value will **not** be in the output array.
212
+ * @param step a **positive** number, dictating how large each step from the `start` to the `end` should be.
213
+ * for safety, so that a user doesn't run into an infinite loop by providing a negative step value,
214
+ * we always take the absolute value of this parameter.
215
+ * defaults to `1`.
216
+ * @param decimal_precision an integer that specifies the number of decimal places to which the output
217
+ * numbers should be rounded to, in order to nullify floating point arithmetic inaccuracy.
218
+ * for instance, in javascript `0.1 + 0.2 = 0.30000000000000004` instead of `0.3`.
219
+ * now, you'd certainly not want to see this kind of number in our output, which is why we round it so that it becomes `0.3`.
220
+ * defaults to `6` (6 decimal places; i.e. rounds to the closest micro-number (10**(-6))).
221
+ * @returns a numeric array with sequentially increasing value from the `start` to the `end` interval, with steps of size `step`.
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * import { assertEquals } from "jsr:@std/assert"
226
+ *
227
+ * // aliasing our functions for brevity
228
+ * const
229
+ * fn = rangeArray,
230
+ * eq = assertEquals
231
+ *
232
+ * eq(fn(0, 5), [0, 1, 2, 3, 4])
233
+ * eq(fn(-2, 3), [-2, -1, 0, 1, 2])
234
+ * eq(fn(2, 7), [2, 3, 4, 5, 6])
235
+ * eq(fn(2, 7.1), [2, 3, 4, 5, 6, 7])
236
+ * eq(fn(0, 1, 0.2), [0, 0.2, 0.4, 0.6, 0.8])
237
+ * eq(fn(0, 100, 20), [0, 20, 40, 60, 80])
238
+ * eq(fn(2, -3), [2, 1, 0, -1, -2])
239
+ * eq(fn(2, -7, 2), [2, 0, -2, -4, -6])
240
+ * eq(fn(2, -7, -2), [2, 0, -2, -4, -6]) // as a protective measure, only the `abs(step)` value is ever taken.
241
+ * eq(fn(2, 7, -1), [2, 3, 4, 5, 6]) // as a protective measure, only the `abs(step)` value is ever taken.
242
+ * ```
243
+ */
244
+ export declare const rangeArray: (start: number, end: number, step?: number, decimal_precision?: number) => Array<number>;
245
+ /** this function is the iterator version of {@link rangeArray}, mimicking python's `range` function.
246
+ *
247
+ * you can iterate indefinitely with this function if you set the {@link end} parameter to `undefined`,
248
+ * and then define the direction of the step increments with the {@link step} parameter.
249
+ * (a negative `step` will result in a decreasing sequence of numbers).
250
+ *
251
+ * @param start the initial number to begin the output range sequence from. defaults to `0`.
252
+ * @param end the final exclusive number to end the output range sequence at. its value will **not** be in the last output number.
253
+ * if left `undefined`, then it will be assumed to be `Number.POSITIVE_INFINITY` if `step` is a positive number (default),
254
+ * or it will become `Number.NEGATIVE_INFINITY` if `step` is a negative number.
255
+ * defaults to `undefined`.
256
+ * @param step a number, dictating how large each step from the `start` to the `end` should be. defaults to `1`.
257
+ * @param decimal_precision an integer that specifies the number of decimal places to which the output
258
+ * numbers should be rounded to, in order to nullify floating point arithmetic inaccuracy.
259
+ * defaults to `6` (6 decimal places; i.e. rounds to the closest micro-number (10**(-6))).
260
+ * @yields a number in the sequence of the given range.
261
+ * @returns the total number of elements that were outputted.
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * import { assertEquals } from "jsr:@std/assert"
266
+ *
267
+ * // aliasing our functions for brevity
268
+ * const
269
+ * fn = rangeIterator,
270
+ * eq = assertEquals
271
+ *
272
+ * eq([...fn(0, 5)], [0, 1, 2, 3, 4])
273
+ * eq([...fn(-2, 3)], [-2, -1, 0, 1, 2])
274
+ * eq([...fn(2, 7)], [2, 3, 4, 5, 6])
275
+ * eq([...fn(2, 7.1)], [2, 3, 4, 5, 6, 7])
276
+ * eq([...fn(0, 1, 0.2)], [0, 0.2, 0.4, 0.6, 0.8])
277
+ * eq([...fn(1, -1, 0.4)], [1, 0.6, 0.2, -0.2, -0.6])
278
+ * eq([...fn(1, -1, -0.4)], [1, 0.6, 0.2, -0.2, -0.6])
279
+ *
280
+ * // indefinite sequence in the positive direction
281
+ * const
282
+ * loop_limit = 10,
283
+ * accumulation_arr: number[] = []
284
+ * for (const v of fn(0)) {
285
+ * if (v >= loop_limit) { break }
286
+ * accumulation_arr.push(v)
287
+ * }
288
+ * eq(accumulation_arr, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
289
+ * accumulation_arr.splice(0) // clearing our array for the next test
290
+ *
291
+ * // indefinite sequence in the negative direction
292
+ * for (const v of fn(0, undefined, -1)) {
293
+ * if (v <= -loop_limit) { break }
294
+ * accumulation_arr.push(v)
295
+ * }
296
+ * eq(accumulation_arr, [0, -1, -2, -3, -4, -5, -6, -7, -8, -9])
297
+ * ```
298
+ */
299
+ export declare const rangeIterator: (start?: number, end?: number | undefined, step?: number, decimal_precision?: number) => IterableIterator<number, number>;
300
+ /** zip together a list of input arrays as tuples, similar to python's `zip` function.
301
+ *
302
+ * > [!note]
303
+ * > if one of the input arrays is shorter in length than all the other input arrays,
304
+ * > then this zip function will only generate tuples up until the shortest array is expended,
305
+ * > similar to how python's `zip` function behaves.
306
+ * > in a sense, this feature is what sets it apart from the 2d array transpose function {@link transposeArray2D},
307
+ * > which decides its output length based on the first array's length.
308
+ *
309
+ * > [!tip]
310
+ * > applying the zip function twice will give you back the original arrays (assuming they all had the same length).
311
+ * > so in a sense, to unzip the output of `zipArrays`, you simply apply `zipArrays` to again (after performing an array spread operation).
312
+ *
313
+ * > [!important]
314
+ * > this function only accepts array inputs to zip, and **not** iterators.
315
+ * > to zip a sequence of iterators, use the {@link zipIterators} function (which has a slightly slower performance).
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * import { assertEquals } from "jsr:@std/assert"
320
+ *
321
+ * type MyObj = { key: string }
322
+ * type MyTuple = [number, boolean, MyObj]
323
+ *
324
+ * const
325
+ * my_num_arr: number[] = [100, 101, 102, 103, 104],
326
+ * my_bool_arr: boolean[] = [true, false, false, true, false],
327
+ * my_obj_arr: MyObj[] = [{ key: "a" }, { key: "b" }, { key: "c" }, { key: "d" }]
328
+ * // notice that `my_obj_arr` is shorter than the other two arrays. (i.e. has a length of `4`, while others are `5`)
329
+ * // this would mean that zipping them together would only generate a 3-tuple array of `4` elements.
330
+ *
331
+ * const my_tuples_arr: MyTuple[] = zipArrays<[number, boolean, MyObj]>(my_num_arr, my_bool_arr, my_obj_arr)
332
+ * assertEquals(my_tuples_arr, [
333
+ * [100, true, { key: "a" }],
334
+ * [101, false, { key: "b" }],
335
+ * [102, false, { key: "c" }],
336
+ * [103, true, { key: "d" }],
337
+ * ])
338
+ *
339
+ * // to unzip the array of tuples, and receive back the original (trimmed) arrays, simply apply `zipArrays` again.
340
+ * const my_arrs = [
341
+ * [ 1, 2, 3, 4],
342
+ * [true, false, true, true],
343
+ * [ "w", "x", "y", "z"],
344
+ * ]
345
+ * assertEquals(zipArrays(...zipArrays(...my_arrs)), my_arrs)
346
+ *
347
+ * // zipping no input arrays should not iterate infinitely.
348
+ * assertEquals(zipArrays(), [])
349
+ * ```
350
+ */
351
+ export declare const zipArrays: <T extends Array<any>>(...arrays: Array<any[]>) => Array<T>;
352
+ /** zip together a list of input iterators or iterable objects as tuples, similar to python's `zip` function.
353
+ *
354
+ * > [!note]
355
+ * > this zip function stops yielding as soon as one of its input iterators is "done" iterating (i.e. out of elements).
356
+ *
357
+ * if all of your input `iterators` are arrays, then use the {@link zipArrays} function, which is more performant (and smaller in footprint).
358
+ *
359
+ * @param iterators the list of iterators/iterable objects which should be zipped.
360
+ * @yields a tuple of each entry from the given list of `iterators`, until one of the iterators is "done" iterating (i.e. out of elements).
361
+ * @returns the number of items that were yielded/iterated (i.e. length of iterator).
362
+ *
363
+ * @example
364
+ * ```ts
365
+ * import { assertEquals } from "jsr:@std/assert"
366
+ *
367
+ * type MyObj = { key: string }
368
+ * type MyTuple = [number, boolean, MyObj]
369
+ *
370
+ * const
371
+ * my_num_iter: Iterable<number> = rangeIterator(100), // infnite iterable, with values `[100, 101, 102, ...]`
372
+ * my_bool_iter: Iterator<boolean> = [true, false, false, true, false][Symbol.iterator](),
373
+ * my_obj_iter: Iterable<MyObj> = [{ key: "a" }, { key: "b" }, { key: "c" }, { key: "d" }]
374
+ * // notice that `my_obj_iter` is shorter than the other two arrays. (i.e. has a length of `4`)
375
+ * // this would mean that zipping them together would only generate a 3-tuple array of `4` elements.
376
+ *
377
+ * const my_tuples_iter: Iterator<MyTuple> = zipIterators<[number, boolean, MyObj]>(my_num_iter, my_bool_iter, my_obj_iter)
378
+ * assertEquals(my_tuples_iter.next(), { value: [100, true, { key: "a" }], done: false })
379
+ * assertEquals(my_tuples_iter.next(), { value: [101, false, { key: "b" }], done: false })
380
+ * assertEquals(my_tuples_iter.next(), { value: [102, false, { key: "c" }], done: false })
381
+ * assertEquals(my_tuples_iter.next(), { value: [103, true, { key: "d" }], done: false })
382
+ * assertEquals(my_tuples_iter.next(), { value: 4, done: true }) // the return value of the iterator dictates its length.
383
+ *
384
+ *
385
+ * // since the actual output of `zipIterators` is an `IterableIterator`,
386
+ * // so we may even use it in a for-of loop, or do an array spreading with the output.
387
+ * const my_tuples_iter2 = zipIterators<[number, boolean]>(my_num_iter, [false, true, false, false, true])
388
+ * my_tuples_iter2 satisfies Iterable<[number, boolean]>
389
+ *
390
+ * // IMPORTANT: notice that the first tuple is not `[104, false]`, but instead `[105, false]`.
391
+ * // this is because our first zip iterator (`my_tuples_iter`) utilized the `my_num_iter` iterable one additional time
392
+ * // before realizing that one of the input iterables (the `my_bool_iter`) had gone out of elements to provide.
393
+ * // thus, the ordering of the iterators do matter, and it is possible to have one iterated value to disappear into the void.
394
+ * assertEquals([...my_tuples_iter2], [
395
+ * [105, false],
396
+ * [106, true ],
397
+ * [107, false],
398
+ * [108, false],
399
+ * [109, true ],
400
+ * ])
401
+ *
402
+ * // zipping with zero sized input iterators should not yield anything.
403
+ * assertEquals([...zipIterators([], [], [])], [])
404
+ *
405
+ * // zipping with no input iterators at all should not iterate infinitely.
406
+ * assertEquals([...zipIterators()], [])
407
+ * ```
408
+ */
409
+ export declare const zipIterators: <T extends Array<any>>(...iterators: Array<Iterator<any> | Iterable<any>>) => IterableIterator<T, number>;
410
+ /** create a mapping function that operates on a list of iterable/iterator inputs, that are zipped together as tuples,
411
+ * and then passed on to the {@link map_fn} for transformation, one by one.
412
+ *
413
+ * > [!note]
414
+ * > if one of the input arrays or iterators is shorter in length than all the rest,
415
+ * > then the mapping function will only operate up till the shortest array/iterator.
416
+ * > similar to how python's `zip` function generates tuples up till the end of the shortest input array.
417
+ *
418
+ * @param map_fn a function that maps each tuple `T` (from the collection of input iterators) to some type `V`.
419
+ * @returns a generator function that will accept a list of iterators as its input,
420
+ * and that yields back the result of each zipped tuple being mapped via `map_fn`.
421
+ * the return value of the generator (after it concludes) is the length of the number of items that it had yielded.
422
+ *
423
+ * @example
424
+ * ```ts
425
+ * import { assertEquals } from "jsr:@std/assert"
426
+ *
427
+ * type MyObj = { key: string }
428
+ * type MyTuple = [number, boolean, MyObj]
429
+ *
430
+ * const myTupleMapper = zipIteratorsMapperFactory((tuple: MyTuple, index: number): string => {
431
+ * const [my_number, my_boolean, my_object] = tuple
432
+ * return `${index}-${my_object.key}/${my_number}/${my_boolean}`
433
+ * })
434
+ *
435
+ * myTupleMapper satisfies ((number_arr: number[], boolean_arr: boolean[], object_arr: MyObj[]) => IterableIterator<string>)
436
+ *
437
+ * const
438
+ * my_num_iter = rangeIterator(100), // infnite iterable, with values `[100, 101, 102, ...]`
439
+ * my_bool_arr = [true, false, false, true, false],
440
+ * my_obj_arr = [{ key: "a" }, { key: "b" }, { key: "c" }, { key: "d" }]
441
+ * // notice that `my_obj_arr` is shorter than the other two arrays. (i.e has a length of `4`).
442
+ * // this would mean that `myTupleMapper` would only operate on the first `4` elements of all the 3 arrays.
443
+ *
444
+ * const outputs_iter: Iterable<string> = myTupleMapper(my_num_iter, my_bool_arr, my_obj_arr)
445
+ * assertEquals([...outputs_iter], [
446
+ * "0-a/100/true",
447
+ * "1-b/101/false",
448
+ * "2-c/102/false",
449
+ * "3-d/103/true",
450
+ * ])
451
+ *
452
+ * // zipping with zero sized input iterators should not yield anything.
453
+ * assertEquals([...myTupleMapper([], [], [])], [])
454
+ *
455
+ * // for safety, map-zipping with no input iterators should not yield anything.
456
+ * assertEquals([...myTupleMapper()], [])
457
+ * ```
458
+ */
459
+ export declare const zipIteratorsMapperFactory: <T extends Array<any>, V>(map_fn: ((tuple: T, index: number) => V)) => ((...iterators: Array<Iterator<any> | Iterable<any>>) => IterableIterator<V, number>);
460
+ /** a generator function that slices your input `array` to smaller chunks of your desired `chunk_size`.
461
+ *
462
+ * note that the final chunk that gets yielded may be smaller than your `chunk_size` if it does not divide `array.length` precisely.
463
+ *
464
+ * @param chunk_size a **positive** integer dictating the length of each chunk that gets yielded.
465
+ * @param array your input array that needs to be yielded in chunks.
466
+ * @yields a chunk of length `chunk_size` from your input `array`.
467
+ *
468
+ * @example
469
+ * ```ts
470
+ * import { assertEquals } from "jsr:@std/assert"
471
+ *
472
+ * const my_arr = rangeArray(0, 30) // equals to `[0, 1, 2, ..., 28, 29]`
473
+ *
474
+ * // below, we split `my_arr` into smaller array chunks of size `8`, except for the last chunk, which is smaller.
475
+ * assertEquals([...chunkGenerator(8, my_arr)], [
476
+ * [ 0, 1, 2, 3, 4, 5, 6, 7 ],
477
+ * [ 8, 9, 10, 11, 12, 13, 14, 15],
478
+ * [16, 17, 18, 19, 20, 21, 22, 23],
479
+ * [24, 25, 26, 27, 28, 29],
480
+ * ])
481
+ *
482
+ * // chunking zero length array will not yield anything
483
+ * assertEquals([...chunkGenerator(8, [])], [])
484
+ * ```
485
+ */
486
+ export declare const chunkGenerator: <T>(chunk_size: number, array: T[]) => Generator<T[], void>;
487
+ //# sourceMappingURL=array1d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array1d.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@oazmi/kitchensink/0.10.0/src/array1d.ts"],"names":[],"mappings":"AAAA;;;EAGE;A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