@ts-fns/stdlib 0.1.0 → 0.2.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 (135) hide show
  1. package/dist/array/index.cjs +230 -33
  2. package/dist/array/index.cjs.map +1 -1
  3. package/dist/array/index.d.cts +434 -32
  4. package/dist/array/index.d.cts.map +1 -1
  5. package/dist/array/index.d.mts +434 -32
  6. package/dist/array/index.d.mts.map +1 -1
  7. package/dist/array/index.mjs +216 -18
  8. package/dist/array/index.mjs.map +1 -1
  9. package/dist/function/index.cjs +4 -2
  10. package/dist/function/index.d.cts +128 -13
  11. package/dist/function/index.d.cts.map +1 -1
  12. package/dist/function/index.d.mts +128 -13
  13. package/dist/function/index.d.mts.map +1 -1
  14. package/dist/function/index.mjs +3 -3
  15. package/dist/{function-DnI2v0p3.mjs → function-CYHPhQCQ.mjs} +84 -6
  16. package/dist/function-CYHPhQCQ.mjs.map +1 -0
  17. package/dist/{function-CB82a2GS.cjs → function-DYPifnmg.cjs} +95 -5
  18. package/dist/function-DYPifnmg.cjs.map +1 -0
  19. package/dist/{get-yrs1Kqho.cjs → get-1kqkxPFX.cjs} +20 -8
  20. package/dist/get-1kqkxPFX.cjs.map +1 -0
  21. package/dist/{get-CWL_cu6G.mjs → get-Dv6ejLZg.mjs} +21 -3
  22. package/dist/get-Dv6ejLZg.mjs.map +1 -0
  23. package/dist/guard/index.cjs +5 -12
  24. package/dist/guard/index.cjs.map +1 -1
  25. package/dist/guard/index.d.cts +18 -17
  26. package/dist/guard/index.d.cts.map +1 -1
  27. package/dist/guard/index.d.mts +18 -17
  28. package/dist/guard/index.d.mts.map +1 -1
  29. package/dist/guard/index.mjs +4 -12
  30. package/dist/guard/index.mjs.map +1 -1
  31. package/dist/index-MbdqaUt1.d.cts +54 -0
  32. package/dist/index-MbdqaUt1.d.cts.map +1 -0
  33. package/dist/index-k-paNOu4.d.mts +54 -0
  34. package/dist/index-k-paNOu4.d.mts.map +1 -0
  35. package/dist/iterator/index.cjs +72 -26
  36. package/dist/iterator/index.cjs.map +1 -1
  37. package/dist/iterator/index.d.cts +157 -5
  38. package/dist/iterator/index.d.cts.map +1 -1
  39. package/dist/iterator/index.d.mts +157 -5
  40. package/dist/iterator/index.d.mts.map +1 -1
  41. package/dist/iterator/index.mjs +66 -24
  42. package/dist/iterator/index.mjs.map +1 -1
  43. package/dist/lens/index.cjs +3 -3
  44. package/dist/lens/index.cjs.map +1 -1
  45. package/dist/lens/index.mjs +3 -3
  46. package/dist/lens/index.mjs.map +1 -1
  47. package/dist/map/index.cjs +88 -1
  48. package/dist/map/index.cjs.map +1 -1
  49. package/dist/map/index.d.cts +130 -2
  50. package/dist/map/index.d.cts.map +1 -1
  51. package/dist/map/index.d.mts +130 -2
  52. package/dist/map/index.d.mts.map +1 -1
  53. package/dist/map/index.mjs +86 -2
  54. package/dist/map/index.mjs.map +1 -1
  55. package/dist/number/index.cjs +91 -18
  56. package/dist/number/index.cjs.map +1 -1
  57. package/dist/number/index.d.cts +134 -19
  58. package/dist/number/index.d.cts.map +1 -1
  59. package/dist/number/index.d.mts +134 -19
  60. package/dist/number/index.d.mts.map +1 -1
  61. package/dist/number/index.mjs +91 -18
  62. package/dist/number/index.mjs.map +1 -1
  63. package/dist/object/index.cjs +111 -7
  64. package/dist/object/index.cjs.map +1 -1
  65. package/dist/object/index.d.cts +186 -26
  66. package/dist/object/index.d.cts.map +1 -1
  67. package/dist/object/index.d.mts +186 -26
  68. package/dist/object/index.d.mts.map +1 -1
  69. package/dist/object/index.mjs +111 -7
  70. package/dist/object/index.mjs.map +1 -1
  71. package/dist/orNull-CJNrTjhQ.cjs +45 -0
  72. package/dist/orNull-CJNrTjhQ.cjs.map +1 -0
  73. package/dist/orNull-EeXiCxD4.mjs +34 -0
  74. package/dist/orNull-EeXiCxD4.mjs.map +1 -0
  75. package/dist/order/index.cjs +22 -1
  76. package/dist/order/index.cjs.map +1 -1
  77. package/dist/order/index.d.cts +2 -2
  78. package/dist/order/index.d.mts +2 -2
  79. package/dist/order/index.mjs +22 -1
  80. package/dist/order/index.mjs.map +1 -1
  81. package/dist/{order.constants-BWSCg3C7.d.cts → order.constants-DpGY-EDp.d.cts} +4 -1
  82. package/dist/order.constants-DpGY-EDp.d.cts.map +1 -0
  83. package/dist/{order.constants-BWSCg3C7.d.mts → order.constants-DpGY-EDp.d.mts} +4 -1
  84. package/dist/order.constants-DpGY-EDp.d.mts.map +1 -0
  85. package/dist/purry-DXnhXie9.mjs +22 -0
  86. package/dist/purry-DXnhXie9.mjs.map +1 -0
  87. package/dist/purry-Dqp_F64t.cjs +27 -0
  88. package/dist/purry-Dqp_F64t.cjs.map +1 -0
  89. package/dist/set/index.cjs +59 -1
  90. package/dist/set/index.cjs.map +1 -1
  91. package/dist/set/index.d.cts +151 -2
  92. package/dist/set/index.d.cts.map +1 -1
  93. package/dist/set/index.d.mts +151 -2
  94. package/dist/set/index.d.mts.map +1 -1
  95. package/dist/set/index.mjs +59 -2
  96. package/dist/set/index.mjs.map +1 -1
  97. package/dist/string/index.cjs +289 -15
  98. package/dist/string/index.cjs.map +1 -1
  99. package/dist/string/index.d.cts +406 -1
  100. package/dist/string/index.d.cts.map +1 -1
  101. package/dist/string/index.d.mts +406 -1
  102. package/dist/string/index.d.mts.map +1 -1
  103. package/dist/string/index.mjs +271 -4
  104. package/dist/string/index.mjs.map +1 -1
  105. package/dist/tuple/index.cjs +20 -21
  106. package/dist/tuple/index.cjs.map +1 -1
  107. package/dist/tuple/index.d.cts +27 -58
  108. package/dist/tuple/index.d.cts.map +1 -1
  109. package/dist/tuple/index.d.mts +27 -58
  110. package/dist/tuple/index.d.mts.map +1 -1
  111. package/dist/tuple/index.mjs +20 -22
  112. package/dist/tuple/index.mjs.map +1 -1
  113. package/package.json +5 -6
  114. package/dist/function-CB82a2GS.cjs.map +0 -1
  115. package/dist/function-DnI2v0p3.mjs.map +0 -1
  116. package/dist/get-CWL_cu6G.mjs.map +0 -1
  117. package/dist/get-yrs1Kqho.cjs.map +0 -1
  118. package/dist/index-BJlKyBJH.d.cts +0 -18
  119. package/dist/index-BJlKyBJH.d.cts.map +0 -1
  120. package/dist/index-DGrnGMDt.d.mts +0 -18
  121. package/dist/index-DGrnGMDt.d.mts.map +0 -1
  122. package/dist/isNotNil-DrF-ohem.cjs +0 -28
  123. package/dist/isNotNil-DrF-ohem.cjs.map +0 -1
  124. package/dist/isNotNil-R5f1hC53.mjs +0 -23
  125. package/dist/isNotNil-R5f1hC53.mjs.map +0 -1
  126. package/dist/orThrow-V91Jw2lF.mjs +0 -15
  127. package/dist/orThrow-V91Jw2lF.mjs.map +0 -1
  128. package/dist/orThrow-ejzcQYAI.cjs +0 -20
  129. package/dist/orThrow-ejzcQYAI.cjs.map +0 -1
  130. package/dist/order.constants-BWSCg3C7.d.cts.map +0 -1
  131. package/dist/order.constants-BWSCg3C7.d.mts.map +0 -1
  132. package/dist/purry-B2_0DGLV.cjs +0 -28
  133. package/dist/purry-B2_0DGLV.cjs.map +0 -1
  134. package/dist/purry-BOWmqwDB.mjs +0 -23
  135. package/dist/purry-BOWmqwDB.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
- import { t as orThrow } from "../orThrow-V91Jw2lF.mjs";
2
- import { t as purry } from "../purry-BOWmqwDB.mjs";
1
+ import { p as orThrow } from "../function-CYHPhQCQ.mjs";
2
+ import { t as purry } from "../purry-DXnhXie9.mjs";
3
3
  import { a as NotYetImplementedError, i as NotFoundError } from "../errors-Dw1kitu_.mjs";
4
- import "../function-DnI2v0p3.mjs";
4
+ import "../order/index.mjs";
5
5
  //#region src/string/at.ts
6
6
  function atImplementation(str, index) {
7
7
  if (index >= str.length || index < -str.length) return /* @__PURE__ */ new RangeError(`Str.at() :: Invalid index : ${index}`);
@@ -13,6 +13,15 @@ function at(...args) {
13
13
  function atAssert(...args) {
14
14
  return purry(orThrow(atImplementation), args);
15
15
  }
16
+ /**
17
+ * Like `at`, but throws when the index is out of bounds.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * at.assert('hello', 1); // 'e'
22
+ * at.assert('hello', 10); // throws RangeError
23
+ * ```
24
+ */
16
25
  at.assert = atAssert;
17
26
  //#endregion
18
27
  //#region src/string/charCodeAt.ts
@@ -27,6 +36,15 @@ function charCodeAt(...args) {
27
36
  function charCodeAtAssert(...args) {
28
37
  return purry(orThrow(charCodeAtImplementation), args);
29
38
  }
39
+ /**
40
+ * Like `charCodeAt`, but throws when the index is out of bounds.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * charCodeAt.assert('hello', 0); // 104
45
+ * charCodeAt.assert('hello', 10); // throws RangeError
46
+ * ```
47
+ */
30
48
  charCodeAt.assert = charCodeAtAssert;
31
49
  //#endregion
32
50
  //#region src/string/codePointAt.ts
@@ -41,9 +59,43 @@ function codePointAt(...args) {
41
59
  function codePointAtAssert(...args) {
42
60
  return purry(orThrow(codePointAtImplementation), args);
43
61
  }
62
+ /**
63
+ * Like `codePointAt`, but throws when the index is out of bounds.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * codePointAt.assert('hello', 0); // 104
68
+ * codePointAt.assert('hello', 10); // throws RangeError
69
+ * ```
70
+ */
44
71
  codePointAt.assert = codePointAtAssert;
45
72
  //#endregion
73
+ //#region src/string/compare.ts
74
+ /**
75
+ * Compares two strings lexicographically and returns their ordering.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * compare('a', 'b'); // -1
80
+ * compare('b', 'b'); // 0
81
+ * compare('c', 'b'); // 1
82
+ * ```
83
+ */
84
+ function compare(left, right) {
85
+ if (left < right) return -1;
86
+ if (left > right) return 1;
87
+ return 0;
88
+ }
89
+ //#endregion
46
90
  //#region src/string/concat.ts
91
+ /**
92
+ * Concatenates two strings.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * concat('hello', ' world'); // throws NotYetImplementedError
97
+ * ```
98
+ */
47
99
  function concat(str, other) {
48
100
  throw new NotYetImplementedError("Str.concat not yet implemented");
49
101
  }
@@ -88,6 +140,15 @@ function indexOf(...args) {
88
140
  function indexOfAssert(...args) {
89
141
  return purry(orThrow(indexOfImplementation), args);
90
142
  }
143
+ /**
144
+ * Like `indexOf`, but throws when the search string is absent.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * indexOf.assert('hello world', 'world'); // 6
149
+ * indexOf.assert('hello world', 'xyz'); // throws NotFoundError
150
+ * ```
151
+ */
91
152
  indexOf.assert = indexOfAssert;
92
153
  function indexOfPositionImplementation(str, search, position) {
93
154
  return str.indexOf(search, position);
@@ -98,19 +159,125 @@ function indexOfPosition(...args) {
98
159
  function indexOfPositionAssert(...args) {
99
160
  return purry(orThrow(indexOfPositionImplementation), args);
100
161
  }
162
+ /**
163
+ * Like `indexOfPosition`, but throws when the result is an error.
164
+ *
165
+ * @example
166
+ * ```ts
167
+ * indexOfPosition.assert('hello world', 'o', 5); // 7
168
+ * indexOfPosition.assert('hello world', 'o', 8); // throws
169
+ * ```
170
+ */
101
171
  indexOfPosition.assert = indexOfPositionAssert;
102
172
  //#endregion
173
+ //#region src/string/isEmpty.ts
174
+ /**
175
+ * Returns whether a string has no characters.
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * isEmpty(''); // true
180
+ * isEmpty('hello'); // false
181
+ * ```
182
+ */
183
+ function isEmpty(str) {
184
+ return str.length === 0;
185
+ }
186
+ //#endregion
103
187
  //#region src/string/isWellFormed.ts
188
+ /**
189
+ * Returns whether a string is a well-formed Unicode string with no lone surrogates.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * isWellFormed('hello'); // true
194
+ * isWellFormed('\uD800'); // false
195
+ * ```
196
+ */
104
197
  function isWellFormed(str) {
105
198
  return str.isWellFormed();
106
199
  }
107
200
  //#endregion
201
+ //#region src/string/lastIndexOf.ts
202
+ function lastIndexOfImplementation(str, search) {
203
+ const result = str.lastIndexOf(search);
204
+ if (result === -1) return new NotFoundError(`Str.lastIndexOf() :: "${search}" not found in "${str}"`);
205
+ return result;
206
+ }
207
+ function lastIndexOf(...args) {
208
+ return purry(lastIndexOfImplementation, args);
209
+ }
210
+ function lastIndexOfAssert(...args) {
211
+ return purry(orThrow(lastIndexOfImplementation), args);
212
+ }
213
+ /**
214
+ * Like `lastIndexOf`, but throws when the search string is absent.
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * lastIndexOf.assert('hello world', 'o'); // 7
219
+ * lastIndexOf.assert('hello world', 'xyz'); // throws NotFoundError
220
+ * ```
221
+ */
222
+ lastIndexOf.assert = lastIndexOfAssert;
223
+ function lastIndexOfPositionImplementation(str, search, position) {
224
+ const result = str.lastIndexOf(search, position);
225
+ if (result === -1) return new NotFoundError(`Str.lastIndexOf() :: "${search}" not found in "${str}" at position ${position}`);
226
+ return result;
227
+ }
228
+ function lastIndexOfPosition(...args) {
229
+ return purry(lastIndexOfPositionImplementation, args);
230
+ }
231
+ function lastIndexOfPositionAssert(...args) {
232
+ return purry(orThrow(lastIndexOfPositionImplementation), args);
233
+ }
234
+ /**
235
+ * Like `lastIndexOfPosition`, but throws when the search string is absent.
236
+ *
237
+ * @example
238
+ * ```ts
239
+ * lastIndexOfPosition.assert('hello world', 'o', 6); // 4
240
+ * lastIndexOfPosition.assert('hello world', 'o', 3); // throws NotFoundError
241
+ * ```
242
+ */
243
+ lastIndexOfPosition.assert = lastIndexOfPositionAssert;
244
+ //#endregion
245
+ //#region src/string/length.ts
246
+ /**
247
+ * Returns the length of a string in UTF-16 code units.
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * length('hello'); // 5
252
+ * length(''); // 0
253
+ * ```
254
+ */
255
+ function length(str) {
256
+ return str.length;
257
+ }
258
+ //#endregion
108
259
  //#region src/string/localeCompare.ts
260
+ /**
261
+ * Compares two strings using locale-aware rules and returns a sort order number.
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * localeCompare('a', 'b'); // throws NotYetImplementedError
266
+ * ```
267
+ */
109
268
  function localeCompare(left, right) {
110
269
  throw new NotYetImplementedError("Str.localeCompare not yet implemented");
111
270
  }
112
271
  //#endregion
113
272
  //#region src/string/normalize.ts
273
+ /**
274
+ * Returns a Unicode-normalized string using NFC form.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * normalize('café'); // 'café'
279
+ * ```
280
+ */
114
281
  function normalize(str) {
115
282
  return str.normalize();
116
283
  }
@@ -146,9 +313,25 @@ function repeat(...args) {
146
313
  }
147
314
  //#endregion
148
315
  //#region src/string/replace.ts
316
+ /**
317
+ * Replaces the first match of a search value in a string.
318
+ *
319
+ * @example
320
+ * ```ts
321
+ * replace('hello world', 'world', 'there'); // throws NotYetImplementedError
322
+ * ```
323
+ */
149
324
  function replace(str, searchValue, replaceValue) {
150
325
  throw new NotYetImplementedError("Str.replace not yet implemented");
151
326
  }
327
+ /**
328
+ * Replaces all matches of a search value in a string.
329
+ *
330
+ * @example
331
+ * ```ts
332
+ * replaceAll('hello world', 'l', 'L'); // throws NotYetImplementedError
333
+ * ```
334
+ */
152
335
  function replaceAll(str, searchValue, replacement) {
153
336
  throw new NotYetImplementedError("Str.replace not yet implemented");
154
337
  }
@@ -165,6 +348,15 @@ function search(...args) {
165
348
  function searchAssert(...args) {
166
349
  return purry(orThrow(searchImplementation), args);
167
350
  }
351
+ /**
352
+ * Like `search`, but throws when there is no match.
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * search.assert('hello world', /world/); // 6
357
+ * search.assert('hello world', /xyz/); // throws NotFoundError
358
+ * ```
359
+ */
168
360
  search.assert = searchAssert;
169
361
  //#endregion
170
362
  //#region src/string/slice.ts
@@ -223,32 +415,107 @@ function substringEnd(...args) {
223
415
  return purry(substringEndImplementation, args);
224
416
  }
225
417
  //#endregion
418
+ //#region src/string/toLocaleLowerCase.ts
419
+ /**
420
+ * Returns a string with all characters converted to locale-aware lowercase.
421
+ *
422
+ * @example
423
+ * ```ts
424
+ * toLocaleLowerCase('STRASSE'); // throws NotYetImplementedError
425
+ * ```
426
+ */
427
+ function toLocaleLowerCase(str) {
428
+ throw new NotYetImplementedError("Str.toLocaleLowerCase not yet implemented");
429
+ }
430
+ //#endregion
431
+ //#region src/string/toLocaleUpperCase.ts
432
+ /**
433
+ * Returns a string with all characters converted to locale-aware uppercase.
434
+ *
435
+ * @example
436
+ * ```ts
437
+ * toLocaleUpperCase('straße'); // throws NotYetImplementedError
438
+ * ```
439
+ */
440
+ function toLocaleUpperCase(str) {
441
+ throw new NotYetImplementedError("Str.toLocaleUpperCase not yet implemented");
442
+ }
443
+ //#endregion
226
444
  //#region src/string/toLowerCase.ts
445
+ /**
446
+ * Returns a string with all characters converted to lowercase.
447
+ *
448
+ * @example
449
+ * ```ts
450
+ * toLowerCase('HELLO'); // 'hello'
451
+ * ```
452
+ */
227
453
  function toLowerCase(str) {
228
454
  return str.toLowerCase();
229
455
  }
230
456
  //#endregion
231
457
  //#region src/string/toUpperCase.ts
458
+ /**
459
+ * Returns a string with all characters converted to uppercase.
460
+ *
461
+ * @example
462
+ * ```ts
463
+ * toUpperCase('hello'); // 'HELLO'
464
+ * ```
465
+ */
232
466
  function toUpperCase(str) {
233
467
  return str.toUpperCase();
234
468
  }
235
469
  //#endregion
236
470
  //#region src/string/toWellFormed.ts
471
+ /**
472
+ * Returns a well-formed Unicode string by replacing lone surrogates with replacement characters.
473
+ *
474
+ * @example
475
+ * ```ts
476
+ * toWellFormed('\uD800'); // '\uFFFD'
477
+ * toWellFormed('hello'); // 'hello'
478
+ * ```
479
+ */
237
480
  function toWellFormed(str) {
238
481
  return str.toWellFormed();
239
482
  }
240
483
  //#endregion
241
484
  //#region src/string/trim.ts
485
+ /**
486
+ * Removes leading and trailing whitespace from a string.
487
+ *
488
+ * @example
489
+ * ```ts
490
+ * trim(' hello '); // 'hello'
491
+ * ```
492
+ */
242
493
  function trim(str) {
243
494
  return str.trim();
244
495
  }
496
+ /**
497
+ * Removes trailing whitespace from a string.
498
+ *
499
+ * @example
500
+ * ```ts
501
+ * trimEnd(' hello '); // ' hello'
502
+ * ```
503
+ */
245
504
  function trimEnd(str) {
246
505
  return str.trimEnd();
247
506
  }
507
+ /**
508
+ * Removes leading whitespace from a string.
509
+ *
510
+ * @example
511
+ * ```ts
512
+ * trimStart(' hello '); // 'hello '
513
+ * ```
514
+ */
248
515
  function trimStart(str) {
249
516
  return str.trimStart();
250
517
  }
251
518
  //#endregion
252
- export { at, charCodeAt, codePointAt, concat, endsWith, endsWithPosition, includes, includesPosition, indexOf, indexOfPosition, isWellFormed, localeCompare, normalize, normalizeForm, padEnd, padStart, repeat, replace, replaceAll, search, slice, sliceEnd, split, splitLimit, startsWith, startsWithPosition, substring, substringEnd, toLowerCase, toUpperCase, toWellFormed, trim, trimEnd, trimStart };
519
+ export { at, charCodeAt, codePointAt, compare, concat, endsWith, endsWithPosition, includes, includesPosition, indexOf, indexOfPosition, isEmpty, isWellFormed, lastIndexOf, lastIndexOfPosition, length, localeCompare, normalize, normalizeForm, padEnd, padStart, repeat, replace, replaceAll, search, slice, sliceEnd, split, splitLimit, startsWith, startsWithPosition, substring, substringEnd, toLocaleLowerCase, toLocaleUpperCase, toLowerCase, toUpperCase, toWellFormed, trim, trimEnd, trimStart };
253
520
 
254
521
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/string/at.ts","../../src/string/charCodeAt.ts","../../src/string/codePointAt.ts","../../src/string/concat.ts","../../src/string/endsWith.ts","../../src/string/includes.ts","../../src/string/indexOf.ts","../../src/string/isWellFormed.ts","../../src/string/localeCompare.ts","../../src/string/normalize.ts","../../src/string/padEnd.ts","../../src/string/padStart.ts","../../src/string/repeat.ts","../../src/string/replace.ts","../../src/string/search.ts","../../src/string/slice.ts","../../src/string/split.ts","../../src/string/startsWith.ts","../../src/string/substring.ts","../../src/string/toLowerCase.ts","../../src/string/toUpperCase.ts","../../src/string/toWellFormed.ts","../../src/string/trim.ts"],"sourcesContent":["import { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction atImplementation(str: string, index: number): RangeError | string {\n if (index >= str.length || index < -str.length) {\n return new RangeError(`Str.at() :: Invalid index : ${index}`);\n }\n\n return str.at(index)!;\n}\n\nexport function at(index: number): (str: string) => RangeError | string;\nexport function at(str: string, index: number): RangeError | string;\nexport function at(...args: unknown[]): unknown {\n return purry(atImplementation, args);\n}\n\nfunction atAssert(index: number): (str: string) => string;\nfunction atAssert(str: string, index: number): string;\nfunction atAssert(...args: unknown[]): unknown {\n return purry(orThrow(atImplementation), args);\n}\n\nat.assert = atAssert;\n","import { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction charCodeAtImplementation(str: string, index: number): RangeError | number {\n if (index >= str.length || index < -str.length) {\n return new RangeError(`Str.charCodeAt() :: Invalid index : ${index}`);\n }\n\n const adjustedIndex = index < 0 ? str.length + index : index;\n\n return str.charCodeAt(adjustedIndex);\n}\n\nexport function charCodeAt(index: number): (str: string) => RangeError | number;\nexport function charCodeAt(str: string, index: number): RangeError | number;\nexport function charCodeAt(...args: unknown[]): unknown {\n return purry(charCodeAtImplementation, args);\n}\n\nfunction charCodeAtAssert(index: number): (str: string) => number;\nfunction charCodeAtAssert(str: string, index: number): number;\nfunction charCodeAtAssert(...args: unknown[]): unknown {\n return purry(orThrow(charCodeAtImplementation), args);\n}\n\ncharCodeAt.assert = charCodeAtAssert;\n","import { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction codePointAtImplementation(str: string, index: number): RangeError | number {\n if (index >= str.length || index < -str.length) {\n return new RangeError(`Str.codePointAt() :: Invalid index : ${index}`);\n }\n\n const adjustedIndex = index < 0 ? str.length + index : index;\n\n return str.codePointAt(adjustedIndex)!;\n}\n\nexport function codePointAt(index: number): (str: string) => RangeError | number;\nexport function codePointAt(str: string, index: number): RangeError | number;\nexport function codePointAt(...args: unknown[]): unknown {\n return purry(codePointAtImplementation, args);\n}\n\nfunction codePointAtAssert(index: number): (str: string) => number;\nfunction codePointAtAssert(str: string, index: number): number;\nfunction codePointAtAssert(...args: unknown[]): unknown {\n return purry(orThrow(codePointAtImplementation), args);\n}\n\ncodePointAt.assert = codePointAtAssert;\n","import { NotYetImplementedError } from '../errors';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function concat(str: string, other: string): string {\n // TODO: need to think about how to handle the native's variable argument length\n throw new NotYetImplementedError('Str.concat not yet implemented');\n}\n","import { purry } from '../function/purry';\n\nfunction endsWithImplementation(str: string, search: string): boolean {\n return str.endsWith(search);\n}\n\nexport function endsWith(search: string): (str: string) => boolean;\nexport function endsWith(str: string, search: string): boolean;\nexport function endsWith(...args: unknown[]): unknown {\n return purry(endsWithImplementation, args);\n}\n\nfunction endsWithPositionImplementation(str: string, search: string, position: number): boolean {\n return str.endsWith(search, position);\n}\n\nexport function endsWithPosition(search: string, position: number): (str: string) => boolean;\nexport function endsWithPosition(str: string, search: string, position: number): boolean;\nexport function endsWithPosition(...args: unknown[]): unknown {\n return purry(endsWithPositionImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction includesImplementation(str: string, search: string): boolean {\n return str.includes(search);\n}\n\nexport function includes(search: string): (str: string) => boolean;\nexport function includes(str: string, search: string): boolean;\nexport function includes(...args: unknown[]): unknown {\n return purry(includesImplementation, args);\n}\n\nfunction includesPositionImplementation(str: string, search: string, position: number): boolean {\n return str.includes(search, position);\n}\n\nexport function includesPosition(position: number, search: string): (str: string) => boolean;\nexport function includesPosition(str: string, search: string, position: number): boolean;\nexport function includesPosition(...args: unknown[]): unknown {\n return purry(includesPositionImplementation, args);\n}\n","import { NotFoundError } from '../errors';\nimport { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction indexOfImplementation(str: string, search: string): NotFoundError | number {\n const result = str.indexOf(search);\n if (result === -1) {\n return new NotFoundError(`Str.indexOf() :: \"${search}\" not found in \"${str}\"`);\n }\n return result;\n}\n\nexport function indexOf(search: string): (str: string) => NotFoundError | number;\nexport function indexOf(str: string, search: string): NotFoundError | number;\nexport function indexOf(...args: unknown[]): unknown {\n return purry(indexOfImplementation, args);\n}\n\nfunction indexOfAssert(search: string): (str: string) => number;\nfunction indexOfAssert(str: string, search: string): number;\nfunction indexOfAssert(...args: unknown[]): unknown {\n return purry(orThrow(indexOfImplementation), args);\n}\n\nindexOf.assert = indexOfAssert;\n\nfunction indexOfPositionImplementation(str: string, search: string, position: number): NotFoundError | number {\n return str.indexOf(search, position);\n}\n\nexport function indexOfPosition(position: number, search: string): (str: string) => NotFoundError | number;\nexport function indexOfPosition(str: string, search: string, position: number): NotFoundError | number;\nexport function indexOfPosition(...args: unknown[]): unknown {\n return purry(indexOfPositionImplementation, args);\n}\n\nfunction indexOfPositionAssert(position: number, search: string): (str: string) => number;\nfunction indexOfPositionAssert(str: string, search: string, position: number): number;\nfunction indexOfPositionAssert(...args: unknown[]): unknown {\n return purry(orThrow(indexOfPositionImplementation), args);\n}\n\nindexOfPosition.assert = indexOfPositionAssert;\n","export function isWellFormed(str: string): boolean {\n return str.isWellFormed();\n}\n","import { NotYetImplementedError } from '../errors';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function localeCompare(left: string, right: string): number {\n throw new NotYetImplementedError('Str.localeCompare not yet implemented');\n}\n","import { purry } from '../function/purry';\n\nexport function normalize(str: string): string {\n return str.normalize();\n}\n\nfunction normalizeFormImplementation(str: string, form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): string {\n return str.normalize(form);\n}\n\nexport function normalizeForm(form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): (str: string) => string;\nexport function normalizeForm(str: string, form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): string;\nexport function normalizeForm(...args: unknown[]): unknown {\n return purry(normalizeFormImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction padEndImplementation(str: string, targetLength: number, padString: string): string {\n return str.padEnd(targetLength, padString);\n}\n\nexport function padEnd(targetLength: number, padString: string): (str: string) => string;\nexport function padEnd(str: string, targetLength: number, padString: string): string;\nexport function padEnd(...args: unknown[]): unknown {\n return purry(padEndImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction padStartImplementation(str: string, targetLength: number, padString: string): string {\n return str.padStart(targetLength, padString);\n}\n\nexport function padStart(targetLength: number, padString: string): (str: string) => string;\nexport function padStart(str: string, targetLength: number, padString: string): string;\nexport function padStart(...args: unknown[]): unknown {\n return purry(padStartImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction repeatImplementation(str: string, count: number): string {\n return str.repeat(count);\n}\n\nexport function repeat(count: number): (str: string) => string;\nexport function repeat(str: string, count: number): string;\nexport function repeat(...args: unknown[]): unknown {\n return purry(repeatImplementation, args);\n}\n","import { NotYetImplementedError } from '../errors';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function replace(str: string, searchValue: RegExp | string, replaceValue: string): string {\n throw new NotYetImplementedError('Str.replace not yet implemented');\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function replaceAll(str: string, searchValue: RegExp | string, replacement: string): string {\n throw new NotYetImplementedError('Str.replace not yet implemented');\n}\n","import { NotFoundError } from '../errors';\nimport { purry } from '../function';\nimport { orThrow } from '../function/orThrow';\n\nfunction searchImplementation(\n str: string,\n searcher: { [Symbol.search](string: string): number },\n): NotFoundError | number {\n const result = str.search(searcher);\n if (result === -1) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions\n return new NotFoundError(`Str.search() :: \"${searcher}\" not found in \"${str}\"`);\n }\n return result;\n}\n\nexport function search(searcher: { [Symbol.search](string: string): number }): (str: string) => NotFoundError | number;\nexport function search(str: string, searcher: { [Symbol.search](string: string): number }): NotFoundError | number;\nexport function search(...args: unknown[]): unknown {\n return purry(searchImplementation, args);\n}\n\nfunction searchAssert(searcher: { [Symbol.search](string: string): number }): (str: string) => number;\nfunction searchAssert(str: string, searcher: { [Symbol.search](string: string): number }): number;\nfunction searchAssert(...args: unknown[]): unknown {\n return purry(orThrow(searchImplementation), args);\n}\n\nsearch.assert = searchAssert;\n","import { purry } from '../function/purry';\n\nfunction sliceImplementation(str: string, start: number): string {\n return str.slice(start);\n}\n\nexport function slice(start: number): (str: string) => string;\nexport function slice(str: string, start: number): string;\nexport function slice(...args: unknown[]): unknown {\n return purry(sliceImplementation, args);\n}\n\nfunction sliceEndImplementation(str: string, start: number, end: number): string {\n return str.slice(start, end);\n}\n\nexport function sliceEnd(end: number): (str: string, start: number) => string;\nexport function sliceEnd(str: string, start: number, end: number): string;\nexport function sliceEnd(...args: unknown[]): unknown {\n return purry(sliceEndImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction splitImplementation(str: string, separator: string): string[] {\n return str.split(separator);\n}\n\nexport function split(separator: string): (str: string) => string[];\nexport function split(str: string, separator: string): string[];\nexport function split(...args: unknown[]): unknown {\n return purry(splitImplementation, args);\n}\n\nfunction splitLimitImplementation(str: string, separator: string, limit: number): string[] {\n return str.split(separator, limit);\n}\n\nexport function splitLimit(separator: string, limit: number): (str: string) => string[];\nexport function splitLimit(str: string, separator: string, limit: number): string[];\nexport function splitLimit(...args: unknown[]): unknown {\n return purry(splitLimitImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction startsWithImplementation(str: string, search: string): boolean {\n return str.startsWith(search);\n}\n\nexport function startsWith(search: string): (str: string) => boolean;\nexport function startsWith(str: string, search: string): boolean;\nexport function startsWith(...args: unknown[]): unknown {\n return purry(startsWithImplementation, args);\n}\n\nfunction startsWithPositionImplementation(str: string, search: string, position: number): boolean {\n return str.startsWith(search, position);\n}\n\nexport function startsWithPosition(search: string, position: number): (str: string) => boolean;\nexport function startsWithPosition(str: string, search: string, position: number): boolean;\nexport function startsWithPosition(...args: unknown[]): unknown {\n return purry(startsWithPositionImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction substringImplementation(str: string, start: number, end: number): string {\n return str.substring(start, end);\n}\n\nexport function substring(start: number, end: number): (str: string) => string;\nexport function substring(str: string, start: number, end: number): string;\nexport function substring(...args: unknown[]): unknown {\n return purry(substringImplementation, args);\n}\n\nfunction substringEndImplementation(str: string, start: number, end: number): string {\n return str.substring(start, end);\n}\n\nexport function substringEnd(start: number, end: number): (str: string) => string;\nexport function substringEnd(str: string, start: number, end: number): string;\nexport function substringEnd(...args: unknown[]): unknown {\n return purry(substringEndImplementation, args);\n}\n","export function toLowerCase(str: string): string {\n return str.toLowerCase();\n}\n","export function toUpperCase(str: string): string {\n return str.toUpperCase();\n}\n","export function toWellFormed(str: string): string {\n return str.toWellFormed();\n}\n","export function trim(str: string): string {\n return str.trim();\n}\n\nexport function trimEnd(str: string): string {\n return str.trimEnd();\n}\n\nexport function trimStart(str: string): string {\n return str.trimStart();\n}\n"],"mappings":";;;;;AAGA,SAAS,iBAAiB,KAAa,OAAoC;CACzE,IAAI,SAAS,IAAI,UAAU,QAAQ,CAAC,IAAI,QACtC,uBAAO,IAAI,WAAW,+BAA+B,OAAO;CAG9D,OAAO,IAAI,GAAG,KAAK;AACrB;AAIA,SAAgB,GAAG,GAAG,MAA0B;CAC9C,OAAO,MAAM,kBAAkB,IAAI;AACrC;AAIA,SAAS,SAAS,GAAG,MAA0B;CAC7C,OAAO,MAAM,QAAQ,gBAAgB,GAAG,IAAI;AAC9C;AAEA,GAAG,SAAS;;;ACpBZ,SAAS,yBAAyB,KAAa,OAAoC;CACjF,IAAI,SAAS,IAAI,UAAU,QAAQ,CAAC,IAAI,QACtC,uBAAO,IAAI,WAAW,uCAAuC,OAAO;CAGtE,MAAM,gBAAgB,QAAQ,IAAI,IAAI,SAAS,QAAQ;CAEvD,OAAO,IAAI,WAAW,aAAa;AACrC;AAIA,SAAgB,WAAW,GAAG,MAA0B;CACtD,OAAO,MAAM,0BAA0B,IAAI;AAC7C;AAIA,SAAS,iBAAiB,GAAG,MAA0B;CACrD,OAAO,MAAM,QAAQ,wBAAwB,GAAG,IAAI;AACtD;AAEA,WAAW,SAAS;;;ACtBpB,SAAS,0BAA0B,KAAa,OAAoC;CAClF,IAAI,SAAS,IAAI,UAAU,QAAQ,CAAC,IAAI,QACtC,uBAAO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B;CAChG,OAAO,IAAI,WAAW,QAAQ,QAAQ;AACxC;AAIA,SAAgB,mBAAmB,GAAG,MAA0B;CAC9D,OAAO,MAAM,kCAAkC,IAAI;AACrD;;;AClBA,SAAS,wBAAwB,KAAa,OAAe,KAAqB;CAChF,OAAO,IAAI,UAAU,OAAO,GAAG;AACjC;AAIA,SAAgB,UAAU,GAAG,MAA0B;CACrD,OAAO,MAAM,yBAAyB,IAAI;AAC5C;AAEA,SAAS,2BAA2B,KAAa,OAAe,KAAqB;CACnF,OAAO,IAAI,UAAU,OAAO,GAAG;AACjC;AAIA,SAAgB,aAAa,GAAG,MAA0B;CACxD,OAAO,MAAM,4BAA4B,IAAI;AAC/C;;;ACpBA,SAAgB,YAAY,KAAqB;CAC/C,OAAO,IAAI,YAAY;AACzB;;;ACFA,SAAgB,YAAY,KAAqB;CAC/C,OAAO,IAAI,YAAY;AACzB;;;ACFA,SAAgB,aAAa,KAAqB;CAChD,OAAO,IAAI,aAAa;AAC1B;;;ACFA,SAAgB,KAAK,KAAqB;CACxC,OAAO,IAAI,KAAK;AAClB;AAEA,SAAgB,QAAQ,KAAqB;CAC3C,OAAO,IAAI,QAAQ;AACrB;AAEA,SAAgB,UAAU,KAAqB;CAC7C,OAAO,IAAI,UAAU;AACvB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/string/at.ts","../../src/string/charCodeAt.ts","../../src/string/codePointAt.ts","../../src/string/compare.ts","../../src/string/concat.ts","../../src/string/endsWith.ts","../../src/string/includes.ts","../../src/string/indexOf.ts","../../src/string/isEmpty.ts","../../src/string/isWellFormed.ts","../../src/string/lastIndexOf.ts","../../src/string/length.ts","../../src/string/localeCompare.ts","../../src/string/normalize.ts","../../src/string/padEnd.ts","../../src/string/padStart.ts","../../src/string/repeat.ts","../../src/string/replace.ts","../../src/string/search.ts","../../src/string/slice.ts","../../src/string/split.ts","../../src/string/startsWith.ts","../../src/string/substring.ts","../../src/string/toLocaleLowerCase.ts","../../src/string/toLocaleUpperCase.ts","../../src/string/toLowerCase.ts","../../src/string/toUpperCase.ts","../../src/string/toWellFormed.ts","../../src/string/trim.ts"],"sourcesContent":["import { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction atImplementation(str: string, index: number): RangeError | string {\n if (index >= str.length || index < -str.length) {\n return new RangeError(`Str.at() :: Invalid index : ${index}`);\n }\n\n return str.at(index)!;\n}\n\n/**\n * Returns the character at an index, supporting negative indices from the end.\n * Returns a range error when the index is out of bounds.\n *\n * @example\n * ```ts\n * at('hello', 1); // 'e'\n * at(-1)('hello'); // 'o'\n * at('hello', 10); // RangeError\n * ```\n */\nexport function at(index: number): (str: string) => RangeError | string;\nexport function at(str: string, index: number): RangeError | string;\nexport function at(...args: unknown[]): unknown {\n return purry(atImplementation, args);\n}\n\nfunction atAssert(index: number): (str: string) => string;\nfunction atAssert(str: string, index: number): string;\nfunction atAssert(...args: unknown[]): unknown {\n return purry(orThrow(atImplementation), args);\n}\n\n/**\n * Like `at`, but throws when the index is out of bounds.\n *\n * @example\n * ```ts\n * at.assert('hello', 1); // 'e'\n * at.assert('hello', 10); // throws RangeError\n * ```\n */\nat.assert = atAssert;\n","import { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction charCodeAtImplementation(str: string, index: number): RangeError | number {\n if (index >= str.length || index < -str.length) {\n return new RangeError(`Str.charCodeAt() :: Invalid index : ${index}`);\n }\n\n const adjustedIndex = index < 0 ? str.length + index : index;\n\n return str.charCodeAt(adjustedIndex);\n}\n\n/**\n * Returns the UTF-16 code unit at an index, supporting negative indices from the end.\n * Returns a range error when the index is out of bounds.\n *\n * @example\n * ```ts\n * charCodeAt('hello', 0); // 104\n * charCodeAt(-1)('hello'); // 111\n * charCodeAt('hello', 10); // RangeError\n * ```\n */\nexport function charCodeAt(index: number): (str: string) => RangeError | number;\nexport function charCodeAt(str: string, index: number): RangeError | number;\nexport function charCodeAt(...args: unknown[]): unknown {\n return purry(charCodeAtImplementation, args);\n}\n\nfunction charCodeAtAssert(index: number): (str: string) => number;\nfunction charCodeAtAssert(str: string, index: number): number;\nfunction charCodeAtAssert(...args: unknown[]): unknown {\n return purry(orThrow(charCodeAtImplementation), args);\n}\n\n/**\n * Like `charCodeAt`, but throws when the index is out of bounds.\n *\n * @example\n * ```ts\n * charCodeAt.assert('hello', 0); // 104\n * charCodeAt.assert('hello', 10); // throws RangeError\n * ```\n */\ncharCodeAt.assert = charCodeAtAssert;\n","import { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction codePointAtImplementation(str: string, index: number): RangeError | number {\n if (index >= str.length || index < -str.length) {\n return new RangeError(`Str.codePointAt() :: Invalid index : ${index}`);\n }\n\n const adjustedIndex = index < 0 ? str.length + index : index;\n\n return str.codePointAt(adjustedIndex)!;\n}\n\n/**\n * Returns the Unicode code point at an index, supporting negative indices from the end.\n * Returns a range error when the index is out of bounds.\n *\n * @example\n * ```ts\n * codePointAt('hello', 0); // 104\n * codePointAt(-1)('hello'); // 111\n * codePointAt('hello', 10); // RangeError\n * ```\n */\nexport function codePointAt(index: number): (str: string) => RangeError | number;\nexport function codePointAt(str: string, index: number): RangeError | number;\nexport function codePointAt(...args: unknown[]): unknown {\n return purry(codePointAtImplementation, args);\n}\n\nfunction codePointAtAssert(index: number): (str: string) => number;\nfunction codePointAtAssert(str: string, index: number): number;\nfunction codePointAtAssert(...args: unknown[]): unknown {\n return purry(orThrow(codePointAtImplementation), args);\n}\n\n/**\n * Like `codePointAt`, but throws when the index is out of bounds.\n *\n * @example\n * ```ts\n * codePointAt.assert('hello', 0); // 104\n * codePointAt.assert('hello', 10); // throws RangeError\n * ```\n */\ncodePointAt.assert = codePointAtAssert;\n","import type { Order } from '../order';\nimport { eq, gt, lt } from '../order';\n\n/**\n * Compares two strings lexicographically and returns their ordering.\n *\n * @example\n * ```ts\n * compare('a', 'b'); // -1\n * compare('b', 'b'); // 0\n * compare('c', 'b'); // 1\n * ```\n */\nexport function compare(left: string, right: string): Order {\n if (left < right) return lt;\n if (left > right) return gt;\n return eq;\n}\n","import { NotYetImplementedError } from '../errors';\n\n/**\n * Concatenates two strings.\n *\n * @example\n * ```ts\n * concat('hello', ' world'); // throws NotYetImplementedError\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function concat(str: string, other: string): string {\n // TODO: need to think about how to handle the native's variable argument length\n throw new NotYetImplementedError('Str.concat not yet implemented');\n}\n","import { purry } from '../function/purry';\n\nfunction endsWithImplementation(str: string, search: string): boolean {\n return str.endsWith(search);\n}\n\n/**\n * Returns whether a string ends with a search string.\n *\n * @example\n * ```ts\n * endsWith('hello world', 'world'); // true\n * endsWith('hello')('hello world'); // false\n * ```\n */\nexport function endsWith(search: string): (str: string) => boolean;\nexport function endsWith(str: string, search: string): boolean;\nexport function endsWith(...args: unknown[]): unknown {\n return purry(endsWithImplementation, args);\n}\n\nfunction endsWithPositionImplementation(str: string, search: string, position: number): boolean {\n return str.endsWith(search, position);\n}\n\n/**\n * Returns whether a string ends with a search string at or before a position.\n *\n * @example\n * ```ts\n * endsWithPosition('hello world', 'hello', 5); // true\n * endsWithPosition(5, 'hello')('hello world'); // true\n * ```\n */\nexport function endsWithPosition(search: string, position: number): (str: string) => boolean;\nexport function endsWithPosition(str: string, search: string, position: number): boolean;\nexport function endsWithPosition(...args: unknown[]): unknown {\n return purry(endsWithPositionImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction includesImplementation(str: string, search: string): boolean {\n return str.includes(search);\n}\n\n/**\n * Returns whether a string contains a search string.\n *\n * @example\n * ```ts\n * includes('hello world', 'world'); // true\n * includes('xyz')('hello world'); // false\n * ```\n */\nexport function includes(search: string): (str: string) => boolean;\nexport function includes(str: string, search: string): boolean;\nexport function includes(...args: unknown[]): unknown {\n return purry(includesImplementation, args);\n}\n\nfunction includesPositionImplementation(str: string, search: string, position: number): boolean {\n return str.includes(search, position);\n}\n\n/**\n * Returns whether a string contains a search string at or after a position.\n *\n * @example\n * ```ts\n * includesPosition('hello world', 'world', 6); // true\n * includesPosition(6, 'world')('hello world'); // true\n * ```\n */\nexport function includesPosition(position: number, search: string): (str: string) => boolean;\nexport function includesPosition(str: string, search: string, position: number): boolean;\nexport function includesPosition(...args: unknown[]): unknown {\n return purry(includesPositionImplementation, args);\n}\n","import { NotFoundError } from '../errors';\nimport { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction indexOfImplementation(str: string, search: string): NotFoundError | number {\n const result = str.indexOf(search);\n if (result === -1) {\n return new NotFoundError(`Str.indexOf() :: \"${search}\" not found in \"${str}\"`);\n }\n return result;\n}\n\n/**\n * Returns the index of the first occurrence of a search string.\n * Returns a not-found error when the search string is absent.\n *\n * @example\n * ```ts\n * indexOf('hello world', 'world'); // 6\n * indexOf('world')('hello world'); // 6\n * indexOf('hello world', 'xyz'); // NotFoundError\n * ```\n */\nexport function indexOf(search: string): (str: string) => NotFoundError | number;\nexport function indexOf(str: string, search: string): NotFoundError | number;\nexport function indexOf(...args: unknown[]): unknown {\n return purry(indexOfImplementation, args);\n}\n\nfunction indexOfAssert(search: string): (str: string) => number;\nfunction indexOfAssert(str: string, search: string): number;\nfunction indexOfAssert(...args: unknown[]): unknown {\n return purry(orThrow(indexOfImplementation), args);\n}\n\n/**\n * Like `indexOf`, but throws when the search string is absent.\n *\n * @example\n * ```ts\n * indexOf.assert('hello world', 'world'); // 6\n * indexOf.assert('hello world', 'xyz'); // throws NotFoundError\n * ```\n */\nindexOf.assert = indexOfAssert;\n\nfunction indexOfPositionImplementation(str: string, search: string, position: number): NotFoundError | number {\n return str.indexOf(search, position);\n}\n\n/**\n * Returns the index of the first occurrence of a search string at or after a position.\n *\n * @example\n * ```ts\n * indexOfPosition('hello world', 'o', 5); // 7\n * indexOfPosition(5, 'o')('hello world'); // 7\n * indexOfPosition('hello world', 'o', 8); // -1\n * ```\n */\nexport function indexOfPosition(position: number, search: string): (str: string) => NotFoundError | number;\nexport function indexOfPosition(str: string, search: string, position: number): NotFoundError | number;\nexport function indexOfPosition(...args: unknown[]): unknown {\n return purry(indexOfPositionImplementation, args);\n}\n\nfunction indexOfPositionAssert(position: number, search: string): (str: string) => number;\nfunction indexOfPositionAssert(str: string, search: string, position: number): number;\nfunction indexOfPositionAssert(...args: unknown[]): unknown {\n return purry(orThrow(indexOfPositionImplementation), args);\n}\n\n/**\n * Like `indexOfPosition`, but throws when the result is an error.\n *\n * @example\n * ```ts\n * indexOfPosition.assert('hello world', 'o', 5); // 7\n * indexOfPosition.assert('hello world', 'o', 8); // throws\n * ```\n */\nindexOfPosition.assert = indexOfPositionAssert;\n","/**\n * Returns whether a string has no characters.\n *\n * @example\n * ```ts\n * isEmpty(''); // true\n * isEmpty('hello'); // false\n * ```\n */\nexport function isEmpty(str: string): boolean {\n return str.length === 0;\n}\n","/**\n * Returns whether a string is a well-formed Unicode string with no lone surrogates.\n *\n * @example\n * ```ts\n * isWellFormed('hello'); // true\n * isWellFormed('\\uD800'); // false\n * ```\n */\nexport function isWellFormed(str: string): boolean {\n return str.isWellFormed();\n}\n","import { NotFoundError } from '../errors';\nimport { orThrow } from '../function/orThrow';\nimport { purry } from '../function/purry';\n\nfunction lastIndexOfImplementation(str: string, search: string): NotFoundError | number {\n const result = str.lastIndexOf(search);\n if (result === -1) {\n return new NotFoundError(`Str.lastIndexOf() :: \"${search}\" not found in \"${str}\"`);\n }\n return result;\n}\n\n/**\n * Returns the index of the last occurrence of a search string.\n * Returns a not-found error when the search string is absent.\n *\n * @example\n * ```ts\n * lastIndexOf('hello world', 'o'); // 7\n * lastIndexOf('o')('hello world'); // 7\n * lastIndexOf('hello world', 'xyz'); // NotFoundError\n * ```\n */\nexport function lastIndexOf(search: string): (str: string) => NotFoundError | number;\nexport function lastIndexOf(str: string, search: string): NotFoundError | number;\nexport function lastIndexOf(...args: unknown[]): unknown {\n return purry(lastIndexOfImplementation, args);\n}\n\nfunction lastIndexOfAssert(search: string): (str: string) => number;\nfunction lastIndexOfAssert(str: string, search: string): number;\nfunction lastIndexOfAssert(...args: unknown[]): unknown {\n return purry(orThrow(lastIndexOfImplementation), args);\n}\n\n/**\n * Like `lastIndexOf`, but throws when the search string is absent.\n *\n * @example\n * ```ts\n * lastIndexOf.assert('hello world', 'o'); // 7\n * lastIndexOf.assert('hello world', 'xyz'); // throws NotFoundError\n * ```\n */\nlastIndexOf.assert = lastIndexOfAssert;\n\nfunction lastIndexOfPositionImplementation(str: string, search: string, position: number): NotFoundError | number {\n const result = str.lastIndexOf(search, position);\n if (result === -1) {\n return new NotFoundError(`Str.lastIndexOf() :: \"${search}\" not found in \"${str}\" at position ${position}`);\n }\n return result;\n}\n\n/**\n * Returns the index of the last occurrence of a search string at or before a position.\n * Returns a not-found error when the search string is absent.\n *\n * @example\n * ```ts\n * lastIndexOfPosition('hello world', 'o', 6); // 4\n * lastIndexOfPosition(6, 'o')('hello world'); // 4\n * lastIndexOfPosition('hello world', 'o', 3); // NotFoundError\n * ```\n */\nexport function lastIndexOfPosition(position: number, search: string): (str: string) => NotFoundError | number;\nexport function lastIndexOfPosition(str: string, search: string, position: number): NotFoundError | number;\nexport function lastIndexOfPosition(...args: unknown[]): unknown {\n return purry(lastIndexOfPositionImplementation, args);\n}\n\nfunction lastIndexOfPositionAssert(position: number, search: string): (str: string) => number;\nfunction lastIndexOfPositionAssert(str: string, search: string, position: number): number;\nfunction lastIndexOfPositionAssert(...args: unknown[]): unknown {\n return purry(orThrow(lastIndexOfPositionImplementation), args);\n}\n\n/**\n * Like `lastIndexOfPosition`, but throws when the search string is absent.\n *\n * @example\n * ```ts\n * lastIndexOfPosition.assert('hello world', 'o', 6); // 4\n * lastIndexOfPosition.assert('hello world', 'o', 3); // throws NotFoundError\n * ```\n */\nlastIndexOfPosition.assert = lastIndexOfPositionAssert;\n","/**\n * Returns the length of a string in UTF-16 code units.\n *\n * @example\n * ```ts\n * length('hello'); // 5\n * length(''); // 0\n * ```\n */\nexport function length(str: string): number {\n return str.length;\n}\n","import { NotYetImplementedError } from '../errors';\n\n/**\n * Compares two strings using locale-aware rules and returns a sort order number.\n *\n * @example\n * ```ts\n * localeCompare('a', 'b'); // throws NotYetImplementedError\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function localeCompare(left: string, right: string): number {\n throw new NotYetImplementedError('Str.localeCompare not yet implemented');\n}\n","import { purry } from '../function/purry';\n\n/**\n * Returns a Unicode-normalized string using NFC form.\n *\n * @example\n * ```ts\n * normalize('café'); // 'café'\n * ```\n */\nexport function normalize(str: string): string {\n return str.normalize();\n}\n\nfunction normalizeFormImplementation(str: string, form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): string {\n return str.normalize(form);\n}\n\n/**\n * Returns a Unicode-normalized string using the given normalization form.\n *\n * @example\n * ```ts\n * normalizeForm('café', 'NFD'); // decomposed form\n * normalizeForm('NFD')('café'); // decomposed form\n * ```\n */\nexport function normalizeForm(form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): (str: string) => string;\nexport function normalizeForm(str: string, form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): string;\nexport function normalizeForm(...args: unknown[]): unknown {\n return purry(normalizeFormImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction padEndImplementation(str: string, targetLength: number, padString: string): string {\n return str.padEnd(targetLength, padString);\n}\n\n/**\n * Pads the end of a string until it reaches a target length.\n *\n * @example\n * ```ts\n * padEnd('5', 3, '0'); // '500'\n * padEnd(3, '0')('5'); // '500'\n * ```\n */\nexport function padEnd(targetLength: number, padString: string): (str: string) => string;\nexport function padEnd(str: string, targetLength: number, padString: string): string;\nexport function padEnd(...args: unknown[]): unknown {\n return purry(padEndImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction padStartImplementation(str: string, targetLength: number, padString: string): string {\n return str.padStart(targetLength, padString);\n}\n\n/**\n * Pads the start of a string until it reaches a target length.\n *\n * @example\n * ```ts\n * padStart('5', 3, '0'); // '005'\n * padStart(3, '0')('5'); // '005'\n * ```\n */\nexport function padStart(targetLength: number, padString: string): (str: string) => string;\nexport function padStart(str: string, targetLength: number, padString: string): string;\nexport function padStart(...args: unknown[]): unknown {\n return purry(padStartImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction repeatImplementation(str: string, count: number): string {\n return str.repeat(count);\n}\n\n/**\n * Returns a string repeated a given number of times.\n *\n * @example\n * ```ts\n * repeat('ab', 3); // 'ababab'\n * repeat(3)('ab'); // 'ababab'\n * ```\n */\nexport function repeat(count: number): (str: string) => string;\nexport function repeat(str: string, count: number): string;\nexport function repeat(...args: unknown[]): unknown {\n return purry(repeatImplementation, args);\n}\n","import { NotYetImplementedError } from '../errors';\n\n/**\n * Replaces the first match of a search value in a string.\n *\n * @example\n * ```ts\n * replace('hello world', 'world', 'there'); // throws NotYetImplementedError\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function replace(str: string, searchValue: RegExp | string, replaceValue: string): string {\n throw new NotYetImplementedError('Str.replace not yet implemented');\n}\n\n/**\n * Replaces all matches of a search value in a string.\n *\n * @example\n * ```ts\n * replaceAll('hello world', 'l', 'L'); // throws NotYetImplementedError\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function replaceAll(str: string, searchValue: RegExp | string, replacement: string): string {\n throw new NotYetImplementedError('Str.replace not yet implemented');\n}\n","import { NotFoundError } from '../errors';\nimport { purry } from '../function';\nimport { orThrow } from '../function/orThrow';\n\nfunction searchImplementation(\n str: string,\n searcher: { [Symbol.search](string: string): number },\n): NotFoundError | number {\n const result = str.search(searcher);\n if (result === -1) {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string, @typescript-eslint/restrict-template-expressions\n return new NotFoundError(`Str.search() :: \"${searcher}\" not found in \"${str}\"`);\n }\n return result;\n}\n\n/**\n * Returns the index of the first match for a searcher (string or regular expression).\n * Returns a not-found error when there is no match.\n *\n * @example\n * ```ts\n * search('hello world', /world/); // 6\n * search(/world/)('hello world'); // 6\n * search('hello world', /xyz/); // NotFoundError\n * ```\n */\nexport function search(searcher: { [Symbol.search](string: string): number }): (str: string) => NotFoundError | number;\nexport function search(str: string, searcher: { [Symbol.search](string: string): number }): NotFoundError | number;\nexport function search(...args: unknown[]): unknown {\n return purry(searchImplementation, args);\n}\n\nfunction searchAssert(searcher: { [Symbol.search](string: string): number }): (str: string) => number;\nfunction searchAssert(str: string, searcher: { [Symbol.search](string: string): number }): number;\nfunction searchAssert(...args: unknown[]): unknown {\n return purry(orThrow(searchImplementation), args);\n}\n\n/**\n * Like `search`, but throws when there is no match.\n *\n * @example\n * ```ts\n * search.assert('hello world', /world/); // 6\n * search.assert('hello world', /xyz/); // throws NotFoundError\n * ```\n */\nsearch.assert = searchAssert;\n","import { purry } from '../function/purry';\n\nfunction sliceImplementation(str: string, start: number): string {\n return str.slice(start);\n}\n\n/**\n * Returns a substring from a start index to the end.\n *\n * @example\n * ```ts\n * slice('hello', 1); // 'ello'\n * slice(1)('hello'); // 'ello'\n * ```\n */\nexport function slice(start: number): (str: string) => string;\nexport function slice(str: string, start: number): string;\nexport function slice(...args: unknown[]): unknown {\n return purry(sliceImplementation, args);\n}\n\nfunction sliceEndImplementation(str: string, start: number, end: number): string {\n return str.slice(start, end);\n}\n\n/**\n * Returns a substring between start and end indices.\n *\n * @example\n * ```ts\n * sliceEnd('hello', 1, 4); // 'ell'\n * sliceEnd(4)(1)('hello'); // 'ell'\n * ```\n */\nexport function sliceEnd(end: number): (str: string, start: number) => string;\nexport function sliceEnd(str: string, start: number, end: number): string;\nexport function sliceEnd(...args: unknown[]): unknown {\n return purry(sliceEndImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction splitImplementation(str: string, separator: string): string[] {\n return str.split(separator);\n}\n\n/**\n * Splits a string into substrings using a separator.\n *\n * @example\n * ```ts\n * split('a,b,c', ','); // ['a', 'b', 'c']\n * split(',')('a,b,c'); // ['a', 'b', 'c']\n * ```\n */\nexport function split(separator: string): (str: string) => string[];\nexport function split(str: string, separator: string): string[];\nexport function split(...args: unknown[]): unknown {\n return purry(splitImplementation, args);\n}\n\nfunction splitLimitImplementation(str: string, separator: string, limit: number): string[] {\n return str.split(separator, limit);\n}\n\n/**\n * Splits a string into at most `limit` substrings using a separator.\n *\n * @example\n * ```ts\n * splitLimit('a,b,c', ',', 2); // ['a', 'b']\n * splitLimit(',', 2)('a,b,c'); // ['a', 'b']\n * ```\n */\nexport function splitLimit(separator: string, limit: number): (str: string) => string[];\nexport function splitLimit(str: string, separator: string, limit: number): string[];\nexport function splitLimit(...args: unknown[]): unknown {\n return purry(splitLimitImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction startsWithImplementation(str: string, search: string): boolean {\n return str.startsWith(search);\n}\n\n/**\n * Returns whether a string starts with a search string.\n *\n * @example\n * ```ts\n * startsWith('hello world', 'hello'); // true\n * startsWith('world')('hello world'); // false\n * ```\n */\nexport function startsWith(search: string): (str: string) => boolean;\nexport function startsWith(str: string, search: string): boolean;\nexport function startsWith(...args: unknown[]): unknown {\n return purry(startsWithImplementation, args);\n}\n\nfunction startsWithPositionImplementation(str: string, search: string, position: number): boolean {\n return str.startsWith(search, position);\n}\n\n/**\n * Returns whether a string starts with a search string at or after a position.\n *\n * @example\n * ```ts\n * startsWithPosition('hello world', 'world', 6); // true\n * startsWithPosition(6, 'world')('hello world'); // true\n * ```\n */\nexport function startsWithPosition(search: string, position: number): (str: string) => boolean;\nexport function startsWithPosition(str: string, search: string, position: number): boolean;\nexport function startsWithPosition(...args: unknown[]): unknown {\n return purry(startsWithPositionImplementation, args);\n}\n","import { purry } from '../function/purry';\n\nfunction substringImplementation(str: string, start: number, end: number): string {\n return str.substring(start, end);\n}\n\n/**\n * Returns the substring between start and end indices.\n *\n * @example\n * ```ts\n * substring('hello', 1, 4); // 'ell'\n * substring(1, 4)('hello'); // 'ell'\n * ```\n */\nexport function substring(start: number, end: number): (str: string) => string;\nexport function substring(str: string, start: number, end: number): string;\nexport function substring(...args: unknown[]): unknown {\n return purry(substringImplementation, args);\n}\n\nfunction substringEndImplementation(str: string, start: number, end: number): string {\n return str.substring(start, end);\n}\n\n/**\n * Returns the substring between start and end indices.\n *\n * @example\n * ```ts\n * substringEnd('hello', 1, 4); // 'ell'\n * substringEnd(1, 4)('hello'); // 'ell'\n * ```\n */\nexport function substringEnd(start: number, end: number): (str: string) => string;\nexport function substringEnd(str: string, start: number, end: number): string;\nexport function substringEnd(...args: unknown[]): unknown {\n return purry(substringEndImplementation, args);\n}\n","import { NotYetImplementedError } from '../errors';\n\n/**\n * Returns a string with all characters converted to locale-aware lowercase.\n *\n * @example\n * ```ts\n * toLocaleLowerCase('STRASSE'); // throws NotYetImplementedError\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function toLocaleLowerCase(str: string): string {\n throw new NotYetImplementedError('Str.toLocaleLowerCase not yet implemented');\n}\n","import { NotYetImplementedError } from '../errors';\n\n/**\n * Returns a string with all characters converted to locale-aware uppercase.\n *\n * @example\n * ```ts\n * toLocaleUpperCase('straße'); // throws NotYetImplementedError\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function toLocaleUpperCase(str: string): string {\n throw new NotYetImplementedError('Str.toLocaleUpperCase not yet implemented');\n}\n","/**\n * Returns a string with all characters converted to lowercase.\n *\n * @example\n * ```ts\n * toLowerCase('HELLO'); // 'hello'\n * ```\n */\nexport function toLowerCase(str: string): string {\n return str.toLowerCase();\n}\n","/**\n * Returns a string with all characters converted to uppercase.\n *\n * @example\n * ```ts\n * toUpperCase('hello'); // 'HELLO'\n * ```\n */\nexport function toUpperCase(str: string): string {\n return str.toUpperCase();\n}\n","/**\n * Returns a well-formed Unicode string by replacing lone surrogates with replacement characters.\n *\n * @example\n * ```ts\n * toWellFormed('\\uD800'); // '\\uFFFD'\n * toWellFormed('hello'); // 'hello'\n * ```\n */\nexport function toWellFormed(str: string): string {\n return str.toWellFormed();\n}\n","/**\n * Removes leading and trailing whitespace from a string.\n *\n * @example\n * ```ts\n * trim(' hello '); // 'hello'\n * ```\n */\nexport function trim(str: string): string {\n return str.trim();\n}\n\n/**\n * Removes trailing whitespace from a string.\n *\n * @example\n * ```ts\n * trimEnd(' hello '); // ' hello'\n * ```\n */\nexport function trimEnd(str: string): string {\n return str.trimEnd();\n}\n\n/**\n * Removes leading whitespace from a string.\n *\n * @example\n * ```ts\n * trimStart(' hello '); // 'hello '\n * ```\n */\nexport function trimStart(str: string): string {\n return str.trimStart();\n}\n"],"mappings":";;;;;AAGA,SAAS,iBAAiB,KAAa,OAAoC;CACzE,IAAI,SAAS,IAAI,UAAU,QAAQ,CAAC,IAAI,QACtC,uBAAO,IAAI,WAAW,+BAA+B,OAAO;CAG9D,OAAO,IAAI,GAAG,KAAK;AACrB;AAeA,SAAgB,GAAG,GAAG,MAA0B;CAC9C,OAAO,MAAM,kBAAkB,IAAI;AACrC;AAIA,SAAS,SAAS,GAAG,MAA0B;CAC7C,OAAO,MAAM,QAAQ,gBAAgB,GAAG,IAAI;AAC9C;;;;;;;;;;AAWA,GAAG,SAAS;;;ACxCZ,SAAS,yBAAyB,KAAa,OAAoC;CACjF,IAAI,SAAS,IAAI,UAAU,QAAQ,CAAC,IAAI,QACtC,uBAAO,IAAI,WAAW,uCAAuC,OAAO;CAGtE,MAAM,gBAAgB,QAAQ,IAAI,IAAI,SAAS,QAAQ;CAEvD,OAAO,IAAI,WAAW,aAAa;AACrC;AAeA,SAAgB,WAAW,GAAG,MAA0B;CACtD,OAAO,MAAM,0BAA0B,IAAI;AAC7C;AAIA,SAAS,iBAAiB,GAAG,MAA0B;CACrD,OAAO,MAAM,QAAQ,wBAAwB,GAAG,IAAI;AACtD;;;;;;;;;;AAWA,WAAW,SAAS;;;AC1CpB,SAAS,0BAA0B,KAAa,OAAoC;CAClF,IAAI,SAAS,IAAI,UAAU,QAAQ,CAAC,IAAI,QACtC,uBAAO,IAAI,WAAW,wCAAwC,OAAO;CAGvE,MAAM,gBAAgB,QAAQ,IAAI,IAAI,SAAS,QAAQ;CAEvD,OAAO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gB,UAAU,GAAG,MAA0B;CACrD,OAAO,MAAM,yBAAyB,IAAI;AAC5C;AAEA,SAAS,2BAA2B,KAAa,OAAe,KAAqB;CACnF,OAAO,IAAI,UAAU,OAAO,GAAG;AACjC;AAaA,SAAgB,aAAa,GAAG,MAA0B;CACxD,OAAO,MAAM,4BAA4B,IAAI;AAC/C;;;;;;;;;;;AC3BA,SAAgB,kBAAkB,KAAqB;CACrD,MAAM,IAAI,uBAAuB,2CAA2C;AAC9E;;;;;;;;;;;ACFA,SAAgB,kBAAkB,KAAqB;CACrD,MAAM,IAAI,uBAAuB,2CAA2C;AAC9E;;;;;;;;;;;ACLA,SAAgB,YAAY,KAAqB;CAC/C,OAAO,IAAI,YAAY;AACzB;;;;;;;;;;;ACFA,SAAgB,YAAY,KAAqB;CAC/C,OAAO,IAAI,YAAY;AACzB;;;;;;;;;;;;ACDA,SAAgB,aAAa,KAAqB;CAChD,OAAO,IAAI,aAAa;AAC1B;;;;;;;;;;;ACHA,SAAgB,KAAK,KAAqB;CACxC,OAAO,IAAI,KAAK;AAClB;;;;;;;;;AAUA,SAAgB,QAAQ,KAAqB;CAC3C,OAAO,IAAI,QAAQ;AACrB;;;;;;;;;AAUA,SAAgB,UAAU,KAAqB;CAC7C,OAAO,IAAI,UAAU;AACvB"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_purry = require("../purry-B2_0DGLV.cjs");
2
+ const require_purry = require("../purry-Dqp_F64t.cjs");
3
3
  //#region src/tuple/at.ts
4
4
  function at2Implementation(tuple, index) {
5
5
  if (index < 0) throw new RangeError(`Tuple.at() :: ${index} must be a positive integer`);
@@ -18,19 +18,29 @@ function fanOut(...args) {
18
18
  return require_purry.purry(fanOutImplementation, args);
19
19
  }
20
20
  //#endregion
21
- //#region src/tuple/first.ts
21
+ //#region src/tuple/from.ts
22
22
  /**
23
- * Returns the first element of a tuple with at least one element.
23
+ * Builds a two-element tuple from two values.
24
24
  *
25
- * @param tuple - A non-empty tuple.
26
- * @returns The element at index `0`.
25
+ * @example
26
+ * ```ts
27
+ * from(1, 'a'); // [1, 'a']
28
+ * ```
29
+ */
30
+ function from(arg1, arg2) {
31
+ return [arg1, arg2];
32
+ }
33
+ //#endregion
34
+ //#region src/tuple/first.ts
35
+ /**
36
+ * Returns the first element of a non-empty tuple.
37
+ * Throws a range error when the tuple has fewer than one element.
27
38
  *
28
39
  * @example
29
40
  * ```ts
30
41
  * first([1, 2]); // 1
42
+ * first([]); // throws RangeError
31
43
  * ```
32
- *
33
- * @throws {RangeError} When the tuple has fewer than one element.
34
44
  */
35
45
  function first(tuple) {
36
46
  if (tuple.length < 1) throw new RangeError("Tuple.first() :: received a tuple with less than 1 element");
@@ -46,9 +56,6 @@ function insert(...args) {
46
56
  }
47
57
  //#endregion
48
58
  //#region src/tuple/mapBoth.ts
49
- /**
50
- * Maps both elements of a homogeneous pair with the same function.
51
- */
52
59
  function mapBothImplementation(tuple, fn) {
53
60
  return [fn(tuple[0]), fn(tuple[1])];
54
61
  }
@@ -65,9 +72,6 @@ function mapEach(...args) {
65
72
  }
66
73
  //#endregion
67
74
  //#region src/tuple/mapFirst.ts
68
- /**
69
- * Maps the first element of a pair; leaves the second unchanged.
70
- */
71
75
  function mapFirstImplementation(tuple, fn) {
72
76
  return [fn(tuple[0]), tuple[1]];
73
77
  }
@@ -86,16 +90,13 @@ function mapSecond(...args) {
86
90
  //#region src/tuple/second.ts
87
91
  /**
88
92
  * Returns the second element of a tuple with at least two elements.
89
- *
90
- * @param tuple - A tuple with at least two elements.
91
- * @returns The element at index `1`.
93
+ * Throws a range error when the tuple has fewer than two elements.
92
94
  *
93
95
  * @example
94
96
  * ```ts
95
97
  * second([1, 2]); // 2
98
+ * second([1]); // throws RangeError
96
99
  * ```
97
- *
98
- * @throws {RangeError} When the tuple has fewer than two elements.
99
100
  */
100
101
  function second(tuple) {
101
102
  if (tuple.length < 2) throw new RangeError("Tuple.second() :: received a tuple with less than 2 elements");
@@ -106,9 +107,6 @@ function second(tuple) {
106
107
  /**
107
108
  * Swaps the two elements of a pair.
108
109
  *
109
- * @param data - A two-element tuple.
110
- * @returns The tuple with elements reversed.
111
- *
112
110
  * @example
113
111
  * ```ts
114
112
  * swap([1, 'a']); // ['a', 1]
@@ -122,6 +120,7 @@ exports.at = at;
122
120
  exports.fanOut = fanOut;
123
121
  exports.fanOutImplementation = fanOutImplementation;
124
122
  exports.first = first;
123
+ exports.from = from;
125
124
  exports.insert = insert;
126
125
  exports.mapBoth = mapBoth;
127
126
  exports.mapBothImplementation = mapBothImplementation;