effect 3.13.8 → 3.13.10

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 (335) hide show
  1. package/dist/cjs/Array.js +460 -431
  2. package/dist/cjs/Array.js.map +1 -1
  3. package/dist/cjs/BigDecimal.js +31 -89
  4. package/dist/cjs/BigDecimal.js.map +1 -1
  5. package/dist/cjs/BigInt.js +27 -71
  6. package/dist/cjs/BigInt.js.map +1 -1
  7. package/dist/cjs/Boolean.js +12 -10
  8. package/dist/cjs/Boolean.js.map +1 -1
  9. package/dist/cjs/Brand.js +2 -0
  10. package/dist/cjs/Brand.js.map +1 -1
  11. package/dist/cjs/Channel.js +0 -2
  12. package/dist/cjs/Channel.js.map +1 -1
  13. package/dist/cjs/Chunk.js +4 -0
  14. package/dist/cjs/Chunk.js.map +1 -1
  15. package/dist/cjs/Config.js +0 -5
  16. package/dist/cjs/Config.js.map +1 -1
  17. package/dist/cjs/Context.js +14 -24
  18. package/dist/cjs/Context.js.map +1 -1
  19. package/dist/cjs/Cron.js +11 -25
  20. package/dist/cjs/Cron.js.map +1 -1
  21. package/dist/cjs/Data.js +6 -0
  22. package/dist/cjs/Data.js.map +1 -1
  23. package/dist/cjs/DateTime.js +2 -0
  24. package/dist/cjs/DateTime.js.map +1 -1
  25. package/dist/cjs/Duration.js +2 -2
  26. package/dist/cjs/Effect.js +122 -53
  27. package/dist/cjs/Effect.js.map +1 -1
  28. package/dist/cjs/Either.js +21 -25
  29. package/dist/cjs/Either.js.map +1 -1
  30. package/dist/cjs/Encoding.js +1 -1
  31. package/dist/cjs/Equivalence.js +1 -1
  32. package/dist/cjs/Function.js +21 -24
  33. package/dist/cjs/Function.js.map +1 -1
  34. package/dist/cjs/HashMap.js +0 -3
  35. package/dist/cjs/HashMap.js.map +1 -1
  36. package/dist/cjs/Iterable.js +9 -2
  37. package/dist/cjs/Iterable.js.map +1 -1
  38. package/dist/cjs/List.js +2 -0
  39. package/dist/cjs/List.js.map +1 -1
  40. package/dist/cjs/Logger.js +0 -2
  41. package/dist/cjs/Logger.js.map +1 -1
  42. package/dist/cjs/Mailbox.js +1 -0
  43. package/dist/cjs/Mailbox.js.map +1 -1
  44. package/dist/cjs/ManagedRuntime.js +0 -2
  45. package/dist/cjs/ManagedRuntime.js.map +1 -1
  46. package/dist/cjs/Metric.js +6 -12
  47. package/dist/cjs/Metric.js.map +1 -1
  48. package/dist/cjs/Number.js +22 -61
  49. package/dist/cjs/Number.js.map +1 -1
  50. package/dist/cjs/Option.js +5 -0
  51. package/dist/cjs/Option.js.map +1 -1
  52. package/dist/cjs/Order.js +1 -0
  53. package/dist/cjs/Order.js.map +1 -1
  54. package/dist/cjs/Ordering.js +2 -7
  55. package/dist/cjs/Ordering.js.map +1 -1
  56. package/dist/cjs/Pool.js +1 -1
  57. package/dist/cjs/Predicate.js +36 -77
  58. package/dist/cjs/Predicate.js.map +1 -1
  59. package/dist/cjs/Random.js +1 -2
  60. package/dist/cjs/Random.js.map +1 -1
  61. package/dist/cjs/RcMap.js +5 -2
  62. package/dist/cjs/RcMap.js.map +1 -1
  63. package/dist/cjs/Record.js +28 -107
  64. package/dist/cjs/Record.js.map +1 -1
  65. package/dist/cjs/Redacted.js +3 -0
  66. package/dist/cjs/Redacted.js.map +1 -1
  67. package/dist/cjs/RegExp.js +2 -2
  68. package/dist/cjs/RegExp.js.map +1 -1
  69. package/dist/cjs/STM.js +3 -5
  70. package/dist/cjs/STM.js.map +1 -1
  71. package/dist/cjs/Schedule.js +2 -2
  72. package/dist/cjs/Schema.js +16 -14
  73. package/dist/cjs/Schema.js.map +1 -1
  74. package/dist/cjs/SchemaAST.js +0 -2
  75. package/dist/cjs/SchemaAST.js.map +1 -1
  76. package/dist/cjs/Sink.js +14 -10
  77. package/dist/cjs/Sink.js.map +1 -1
  78. package/dist/cjs/Stream.js +24 -25
  79. package/dist/cjs/Stream.js.map +1 -1
  80. package/dist/cjs/String.js +31 -2
  81. package/dist/cjs/String.js.map +1 -1
  82. package/dist/cjs/Struct.js +6 -0
  83. package/dist/cjs/Struct.js.map +1 -1
  84. package/dist/cjs/Symbol.js +1 -2
  85. package/dist/cjs/Symbol.js.map +1 -1
  86. package/dist/cjs/TestClock.js.map +1 -1
  87. package/dist/cjs/Trie.js +28 -0
  88. package/dist/cjs/Trie.js.map +1 -1
  89. package/dist/cjs/Tuple.js +9 -24
  90. package/dist/cjs/Tuple.js.map +1 -1
  91. package/dist/cjs/internal/matcher.js +1 -1
  92. package/dist/cjs/internal/matcher.js.map +1 -1
  93. package/dist/cjs/internal/version.js +1 -1
  94. package/dist/cjs/internal/version.js.map +1 -1
  95. package/dist/dts/Array.d.ts +1235 -1188
  96. package/dist/dts/Array.d.ts.map +1 -1
  97. package/dist/dts/BigDecimal.d.ts +61 -189
  98. package/dist/dts/BigDecimal.d.ts.map +1 -1
  99. package/dist/dts/BigInt.d.ts +57 -165
  100. package/dist/dts/BigInt.d.ts.map +1 -1
  101. package/dist/dts/Boolean.d.ts +28 -18
  102. package/dist/dts/Boolean.d.ts.map +1 -1
  103. package/dist/dts/Brand.d.ts +3 -3
  104. package/dist/dts/Brand.d.ts.map +1 -1
  105. package/dist/dts/Channel.d.ts +0 -6
  106. package/dist/dts/Channel.d.ts.map +1 -1
  107. package/dist/dts/Chunk.d.ts +15 -0
  108. package/dist/dts/Chunk.d.ts.map +1 -1
  109. package/dist/dts/Config.d.ts +0 -5
  110. package/dist/dts/Config.d.ts.map +1 -1
  111. package/dist/dts/Context.d.ts +26 -54
  112. package/dist/dts/Context.d.ts.map +1 -1
  113. package/dist/dts/Cron.d.ts +9 -23
  114. package/dist/dts/Cron.d.ts.map +1 -1
  115. package/dist/dts/Data.d.ts +8 -0
  116. package/dist/dts/Data.d.ts.map +1 -1
  117. package/dist/dts/DateTime.d.ts +6 -0
  118. package/dist/dts/DateTime.d.ts.map +1 -1
  119. package/dist/dts/Duration.d.ts +2 -2
  120. package/dist/dts/Effect.d.ts +153 -71
  121. package/dist/dts/Effect.d.ts.map +1 -1
  122. package/dist/dts/Either.d.ts +44 -57
  123. package/dist/dts/Either.d.ts.map +1 -1
  124. package/dist/dts/Encoding.d.ts +1 -1
  125. package/dist/dts/Equivalence.d.ts +1 -1
  126. package/dist/dts/Function.d.ts +55 -59
  127. package/dist/dts/Function.d.ts.map +1 -1
  128. package/dist/dts/HashMap.d.ts +0 -9
  129. package/dist/dts/HashMap.d.ts.map +1 -1
  130. package/dist/dts/Iterable.d.ts +13 -2
  131. package/dist/dts/Iterable.d.ts.map +1 -1
  132. package/dist/dts/List.d.ts +10 -0
  133. package/dist/dts/List.d.ts.map +1 -1
  134. package/dist/dts/Logger.d.ts +0 -6
  135. package/dist/dts/Logger.d.ts.map +1 -1
  136. package/dist/dts/Mailbox.d.ts +1 -0
  137. package/dist/dts/Mailbox.d.ts.map +1 -1
  138. package/dist/dts/ManagedRuntime.d.ts +0 -2
  139. package/dist/dts/ManagedRuntime.d.ts.map +1 -1
  140. package/dist/dts/Metric.d.ts +14 -20
  141. package/dist/dts/Metric.d.ts.map +1 -1
  142. package/dist/dts/Micro.d.ts +1 -1
  143. package/dist/dts/Number.d.ts +52 -155
  144. package/dist/dts/Number.d.ts.map +1 -1
  145. package/dist/dts/Option.d.ts +12 -0
  146. package/dist/dts/Option.d.ts.map +1 -1
  147. package/dist/dts/Order.d.ts +1 -0
  148. package/dist/dts/Order.d.ts.map +1 -1
  149. package/dist/dts/Ordering.d.ts +4 -17
  150. package/dist/dts/Ordering.d.ts.map +1 -1
  151. package/dist/dts/Pool.d.ts +1 -1
  152. package/dist/dts/Predicate.d.ts +56 -133
  153. package/dist/dts/Predicate.d.ts.map +1 -1
  154. package/dist/dts/Random.d.ts +1 -2
  155. package/dist/dts/Random.d.ts.map +1 -1
  156. package/dist/dts/RcMap.d.ts +15 -6
  157. package/dist/dts/RcMap.d.ts.map +1 -1
  158. package/dist/dts/Record.d.ts +68 -279
  159. package/dist/dts/Record.d.ts.map +1 -1
  160. package/dist/dts/Redacted.d.ts +3 -0
  161. package/dist/dts/Redacted.d.ts.map +1 -1
  162. package/dist/dts/RegExp.d.ts +2 -2
  163. package/dist/dts/RegExp.d.ts.map +1 -1
  164. package/dist/dts/STM.d.ts +5 -7
  165. package/dist/dts/STM.d.ts.map +1 -1
  166. package/dist/dts/Schedule.d.ts +7 -7
  167. package/dist/dts/Schema.d.ts +31 -25
  168. package/dist/dts/Schema.d.ts.map +1 -1
  169. package/dist/dts/SchemaAST.d.ts +0 -2
  170. package/dist/dts/SchemaAST.d.ts.map +1 -1
  171. package/dist/dts/Sink.d.ts +14 -10
  172. package/dist/dts/Sink.d.ts.map +1 -1
  173. package/dist/dts/Stream.d.ts +58 -62
  174. package/dist/dts/Stream.d.ts.map +1 -1
  175. package/dist/dts/String.d.ts +47 -2
  176. package/dist/dts/String.d.ts.map +1 -1
  177. package/dist/dts/Struct.d.ts +12 -0
  178. package/dist/dts/Struct.d.ts.map +1 -1
  179. package/dist/dts/Symbol.d.ts +1 -2
  180. package/dist/dts/Symbol.d.ts.map +1 -1
  181. package/dist/dts/TestClock.d.ts +2 -1
  182. package/dist/dts/TestClock.d.ts.map +1 -1
  183. package/dist/dts/Trie.d.ts +66 -0
  184. package/dist/dts/Trie.d.ts.map +1 -1
  185. package/dist/dts/Tuple.d.ts +21 -62
  186. package/dist/dts/Tuple.d.ts.map +1 -1
  187. package/dist/dts/Utils.d.ts +8 -8
  188. package/dist/esm/Array.js +474 -442
  189. package/dist/esm/Array.js.map +1 -1
  190. package/dist/esm/BigDecimal.js +31 -89
  191. package/dist/esm/BigDecimal.js.map +1 -1
  192. package/dist/esm/BigInt.js +27 -71
  193. package/dist/esm/BigInt.js.map +1 -1
  194. package/dist/esm/Boolean.js +12 -10
  195. package/dist/esm/Boolean.js.map +1 -1
  196. package/dist/esm/Brand.js +2 -0
  197. package/dist/esm/Brand.js.map +1 -1
  198. package/dist/esm/Channel.js +0 -2
  199. package/dist/esm/Channel.js.map +1 -1
  200. package/dist/esm/Chunk.js +4 -0
  201. package/dist/esm/Chunk.js.map +1 -1
  202. package/dist/esm/Config.js +0 -5
  203. package/dist/esm/Config.js.map +1 -1
  204. package/dist/esm/Context.js +14 -24
  205. package/dist/esm/Context.js.map +1 -1
  206. package/dist/esm/Cron.js +11 -25
  207. package/dist/esm/Cron.js.map +1 -1
  208. package/dist/esm/Data.js +7 -0
  209. package/dist/esm/Data.js.map +1 -1
  210. package/dist/esm/DateTime.js +2 -0
  211. package/dist/esm/DateTime.js.map +1 -1
  212. package/dist/esm/Duration.js +2 -2
  213. package/dist/esm/Effect.js +123 -53
  214. package/dist/esm/Effect.js.map +1 -1
  215. package/dist/esm/Either.js +22 -25
  216. package/dist/esm/Either.js.map +1 -1
  217. package/dist/esm/Encoding.js +1 -1
  218. package/dist/esm/Equivalence.js +1 -1
  219. package/dist/esm/Function.js +21 -24
  220. package/dist/esm/Function.js.map +1 -1
  221. package/dist/esm/HashMap.js +0 -3
  222. package/dist/esm/HashMap.js.map +1 -1
  223. package/dist/esm/Iterable.js +9 -2
  224. package/dist/esm/Iterable.js.map +1 -1
  225. package/dist/esm/List.js +2 -0
  226. package/dist/esm/List.js.map +1 -1
  227. package/dist/esm/Logger.js +0 -2
  228. package/dist/esm/Logger.js.map +1 -1
  229. package/dist/esm/Mailbox.js +1 -0
  230. package/dist/esm/Mailbox.js.map +1 -1
  231. package/dist/esm/ManagedRuntime.js +0 -2
  232. package/dist/esm/ManagedRuntime.js.map +1 -1
  233. package/dist/esm/Metric.js +6 -12
  234. package/dist/esm/Metric.js.map +1 -1
  235. package/dist/esm/Micro.js +1 -1
  236. package/dist/esm/Number.js +22 -61
  237. package/dist/esm/Number.js.map +1 -1
  238. package/dist/esm/Option.js +6 -0
  239. package/dist/esm/Option.js.map +1 -1
  240. package/dist/esm/Order.js +1 -0
  241. package/dist/esm/Order.js.map +1 -1
  242. package/dist/esm/Ordering.js +2 -7
  243. package/dist/esm/Ordering.js.map +1 -1
  244. package/dist/esm/Pool.js +1 -1
  245. package/dist/esm/Predicate.js +36 -77
  246. package/dist/esm/Predicate.js.map +1 -1
  247. package/dist/esm/Random.js +1 -2
  248. package/dist/esm/Random.js.map +1 -1
  249. package/dist/esm/RcMap.js +5 -2
  250. package/dist/esm/RcMap.js.map +1 -1
  251. package/dist/esm/Record.js +28 -107
  252. package/dist/esm/Record.js.map +1 -1
  253. package/dist/esm/Redacted.js +3 -0
  254. package/dist/esm/Redacted.js.map +1 -1
  255. package/dist/esm/RegExp.js +2 -2
  256. package/dist/esm/RegExp.js.map +1 -1
  257. package/dist/esm/STM.js +3 -5
  258. package/dist/esm/STM.js.map +1 -1
  259. package/dist/esm/Schedule.js +2 -2
  260. package/dist/esm/Schema.js +16 -14
  261. package/dist/esm/Schema.js.map +1 -1
  262. package/dist/esm/SchemaAST.js +0 -2
  263. package/dist/esm/SchemaAST.js.map +1 -1
  264. package/dist/esm/Sink.js +14 -10
  265. package/dist/esm/Sink.js.map +1 -1
  266. package/dist/esm/Stream.js +25 -25
  267. package/dist/esm/Stream.js.map +1 -1
  268. package/dist/esm/String.js +31 -2
  269. package/dist/esm/String.js.map +1 -1
  270. package/dist/esm/Struct.js +6 -0
  271. package/dist/esm/Struct.js.map +1 -1
  272. package/dist/esm/Symbol.js +1 -2
  273. package/dist/esm/Symbol.js.map +1 -1
  274. package/dist/esm/TestClock.js.map +1 -1
  275. package/dist/esm/Trie.js +28 -0
  276. package/dist/esm/Trie.js.map +1 -1
  277. package/dist/esm/Tuple.js +11 -30
  278. package/dist/esm/Tuple.js.map +1 -1
  279. package/dist/esm/internal/matcher.js +1 -1
  280. package/dist/esm/internal/matcher.js.map +1 -1
  281. package/dist/esm/internal/version.js +1 -1
  282. package/dist/esm/internal/version.js.map +1 -1
  283. package/package.json +1 -1
  284. package/src/Array.ts +1235 -1188
  285. package/src/BigDecimal.ts +61 -189
  286. package/src/BigInt.ts +57 -165
  287. package/src/Boolean.ts +28 -18
  288. package/src/Brand.ts +3 -3
  289. package/src/Channel.ts +0 -6
  290. package/src/Chunk.ts +16 -0
  291. package/src/Config.ts +0 -5
  292. package/src/Context.ts +26 -54
  293. package/src/Cron.ts +11 -25
  294. package/src/Data.ts +8 -0
  295. package/src/DateTime.ts +6 -0
  296. package/src/Duration.ts +2 -2
  297. package/src/Effect.ts +153 -71
  298. package/src/Either.ts +45 -58
  299. package/src/Encoding.ts +1 -1
  300. package/src/Equivalence.ts +1 -1
  301. package/src/Function.ts +55 -59
  302. package/src/HashMap.ts +0 -9
  303. package/src/Iterable.ts +13 -2
  304. package/src/List.ts +12 -0
  305. package/src/Logger.ts +0 -6
  306. package/src/Mailbox.ts +1 -0
  307. package/src/ManagedRuntime.ts +0 -2
  308. package/src/Metric.ts +14 -20
  309. package/src/Micro.ts +1 -1
  310. package/src/Number.ts +52 -155
  311. package/src/Option.ts +12 -0
  312. package/src/Order.ts +1 -0
  313. package/src/Ordering.ts +4 -17
  314. package/src/Pool.ts +1 -1
  315. package/src/Predicate.ts +56 -133
  316. package/src/Random.ts +1 -2
  317. package/src/RcMap.ts +15 -6
  318. package/src/Record.ts +68 -279
  319. package/src/Redacted.ts +3 -0
  320. package/src/RegExp.ts +2 -2
  321. package/src/STM.ts +5 -7
  322. package/src/Schedule.ts +7 -7
  323. package/src/Schema.ts +33 -26
  324. package/src/SchemaAST.ts +0 -2
  325. package/src/Sink.ts +14 -10
  326. package/src/Stream.ts +56 -61
  327. package/src/String.ts +47 -2
  328. package/src/Struct.ts +12 -0
  329. package/src/Symbol.ts +1 -2
  330. package/src/TestClock.ts +2 -1
  331. package/src/Trie.ts +66 -0
  332. package/src/Tuple.ts +21 -62
  333. package/src/Utils.ts +8 -8
  334. package/src/internal/matcher.ts +1 -1
  335. package/src/internal/version.ts +1 -1
package/dist/cjs/Array.js CHANGED
@@ -28,12 +28,13 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
28
28
  /**
29
29
  * Builds a `NonEmptyArray` from an non-empty collection of elements.
30
30
  *
31
- * @example
31
+ * **Example**
32
+ *
32
33
  * ```ts
33
34
  * import { Array } from "effect"
34
35
  *
35
36
  * const result = Array.make(1, 2, 3)
36
- * assert.deepStrictEqual(result, [1, 2, 3])
37
+ * console.log(result) // [1, 2, 3]
37
38
  * ```
38
39
  *
39
40
  * @category constructors
@@ -43,12 +44,13 @@ const make = (...elements) => elements;
43
44
  /**
44
45
  * Creates a new `Array` of the specified length.
45
46
  *
46
- * @example
47
+ * **Example**
48
+ *
47
49
  * ```ts
48
50
  * import { Array } from "effect"
49
51
  *
50
52
  * const result = Array.allocate<number>(3)
51
- * assert.deepStrictEqual(result.length, 3)
53
+ * console.log(result) // [ <3 empty items> ]
52
54
  * ```
53
55
  *
54
56
  * @category constructors
@@ -61,11 +63,13 @@ const allocate = n => new Array(n);
61
63
  *
62
64
  * **Note**. `n` is normalized to an integer >= 1.
63
65
  *
64
- * @example
66
+ * **Example**
67
+ *
65
68
  * ```ts
66
69
  * import { makeBy } from "effect/Array"
67
70
  *
68
- * assert.deepStrictEqual(makeBy(5, n => n * 2), [0, 2, 4, 6, 8])
71
+ * const result = makeBy(5, n => n * 2)
72
+ * console.log(result) // [0, 2, 4, 6, 8]
69
73
  * ```
70
74
  *
71
75
  * @category constructors
@@ -83,11 +87,13 @@ const makeBy = exports.makeBy = /*#__PURE__*/(0, _Function.dual)(2, (n, f) => {
83
87
  /**
84
88
  * Return a `NonEmptyArray` containing a range of integers, including both endpoints.
85
89
  *
86
- * @example
90
+ * **Example**
91
+ *
87
92
  * ```ts
88
93
  * import { range } from "effect/Array"
89
94
  *
90
- * assert.deepStrictEqual(range(1, 3), [1, 2, 3])
95
+ * const result = range(1, 3)
96
+ * console.log(result) // [1, 2, 3]
91
97
  * ```
92
98
  *
93
99
  * @category constructors
@@ -99,11 +105,13 @@ const range = (start, end) => start <= end ? makeBy(end - start + 1, i => start
99
105
  *
100
106
  * **Note**. `n` is normalized to an integer >= 1.
101
107
  *
102
- * @example
108
+ * **Example**
109
+ *
103
110
  * ```ts
104
111
  * import { Array } from "effect"
105
112
  *
106
- * assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"])
113
+ * const result = Array.replicate("a", 3)
114
+ * console.log(result) // ["a", "a", "a"]
107
115
  * ```
108
116
  *
109
117
  * @category constructors
@@ -116,13 +124,13 @@ const replicate = exports.replicate = /*#__PURE__*/(0, _Function.dual)(2, (a, n)
116
124
  * If the input is already an array, it returns the input as-is.
117
125
  * Otherwise, it converts the iterable collection to an array.
118
126
  *
119
- * @example
127
+ * **Example**
128
+ *
120
129
  * ```ts
121
130
  * import { Array } from "effect"
122
131
  *
123
- * const set = new Set([1, 2, 3])
124
- * const result = Array.fromIterable(set)
125
- * assert.deepStrictEqual(result, [1, 2, 3])
132
+ * const result = Array.fromIterable(new Set([1, 2, 3]))
133
+ * console.log(result) // [1, 2, 3]
126
134
  * ```
127
135
  *
128
136
  * @category constructors
@@ -132,13 +140,14 @@ const fromIterable = collection => Array.isArray(collection) ? collection : Arra
132
140
  /**
133
141
  * Creates a new `Array` from a value that might not be an iterable.
134
142
  *
135
- * @example
143
+ * **Example**
144
+ *
136
145
  * ```ts
137
146
  * import { Array } from "effect"
138
147
  *
139
- * assert.deepStrictEqual(Array.ensure("a"), ["a"])
140
- * assert.deepStrictEqual(Array.ensure(["a"]), ["a"])
141
- * assert.deepStrictEqual(Array.ensure(["a", "b", "c"]), ["a", "b", "c"])
148
+ * console.log(Array.ensure("a")) // ["a"]
149
+ * console.log(Array.ensure(["a"])) // ["a"]
150
+ * console.log(Array.ensure(["a", "b", "c"])) // ["a", "b", "c"]
142
151
  * ```
143
152
  *
144
153
  * @category constructors
@@ -149,14 +158,13 @@ const ensure = self => Array.isArray(self) ? self : [self];
149
158
  /**
150
159
  * Takes a record and returns an array of tuples containing its keys and values.
151
160
  *
152
- * @param self - The record to transform.
161
+ * **Example**
153
162
  *
154
- * @example
155
163
  * ```ts
156
164
  * import { Array } from "effect"
157
165
  *
158
- * const x = { a: 1, b: 2, c: 3 }
159
- * assert.deepStrictEqual(Array.fromRecord(x), [["a", 1], ["b", 2], ["c", 3]])
166
+ * const result = Array.fromRecord({ a: 1, b: 2, c: 3 })
167
+ * console.log(result) // [["a", 1], ["b", 2], ["c", 3]]
160
168
  * ```
161
169
  *
162
170
  * @category conversions
@@ -167,12 +175,13 @@ const fromRecord = exports.fromRecord = Record.toEntries;
167
175
  /**
168
176
  * Converts an `Option` to an array.
169
177
  *
170
- * @example
178
+ * **Example**
179
+ *
171
180
  * ```ts
172
181
  * import { Array, Option } from "effect"
173
182
  *
174
- * assert.deepStrictEqual(Array.fromOption(Option.some(1)), [1])
175
- * assert.deepStrictEqual(Array.fromOption(Option.none()), [])
183
+ * console.log(Array.fromOption(Option.some(1))) // [1]
184
+ * console.log(Array.fromOption(Option.none())) // []
176
185
  * ```
177
186
  *
178
187
  * @category conversions
@@ -182,7 +191,8 @@ const fromOption = exports.fromOption = O.toArray;
182
191
  /**
183
192
  * Matches the elements of an array, applying functions to cases of empty and non-empty arrays.
184
193
  *
185
- * @example
194
+ * **Example**
195
+ *
186
196
  * ```ts
187
197
  * import { Array } from "effect"
188
198
  *
@@ -190,8 +200,8 @@ const fromOption = exports.fromOption = O.toArray;
190
200
  * onEmpty: () => "empty",
191
201
  * onNonEmpty: ([head, ...tail]) => `head: ${head}, tail: ${tail.length}`
192
202
  * })
193
- * assert.deepStrictEqual(match([]), "empty")
194
- * assert.deepStrictEqual(match([1, 2, 3]), "head: 1, tail: 2")
203
+ * console.log(match([])) // "empty"
204
+ * console.log(match([1, 2, 3])) // "head: 1, tail: 2"
195
205
  * ```
196
206
  *
197
207
  * @category pattern matching
@@ -204,7 +214,8 @@ const match = exports.match = /*#__PURE__*/(0, _Function.dual)(2, (self, {
204
214
  /**
205
215
  * Matches the elements of an array from the left, applying functions to cases of empty and non-empty arrays.
206
216
  *
207
- * @example
217
+ * **Example**
218
+ *
208
219
  * ```ts
209
220
  * import { Array } from "effect"
210
221
  *
@@ -212,8 +223,8 @@ const match = exports.match = /*#__PURE__*/(0, _Function.dual)(2, (self, {
212
223
  * onEmpty: () => "empty",
213
224
  * onNonEmpty: (head, tail) => `head: ${head}, tail: ${tail.length}`
214
225
  * })
215
- * assert.deepStrictEqual(matchLeft([]), "empty")
216
- * assert.deepStrictEqual(matchLeft([1, 2, 3]), "head: 1, tail: 2")
226
+ * console.log(matchLeft([])) // "empty"
227
+ * console.log(matchLeft([1, 2, 3])) // "head: 1, tail: 2"
217
228
  * ```
218
229
  *
219
230
  * @category pattern matching
@@ -226,7 +237,8 @@ const matchLeft = exports.matchLeft = /*#__PURE__*/(0, _Function.dual)(2, (self,
226
237
  /**
227
238
  * Matches the elements of an array from the right, applying functions to cases of empty and non-empty arrays.
228
239
  *
229
- * @example
240
+ * **Example**
241
+ *
230
242
  * ```ts
231
243
  * import { Array } from "effect"
232
244
  *
@@ -234,8 +246,8 @@ const matchLeft = exports.matchLeft = /*#__PURE__*/(0, _Function.dual)(2, (self,
234
246
  * onEmpty: () => "empty",
235
247
  * onNonEmpty: (init, last) => `init: ${init.length}, last: ${last}`
236
248
  * })
237
- * assert.deepStrictEqual(matchRight([]), "empty")
238
- * assert.deepStrictEqual(matchRight([1, 2, 3]), "init: 2, last: 3")
249
+ * console.log(matchRight([])) // "empty"
250
+ * console.log(matchRight([1, 2, 3])) // "init: 2, last: 3"
239
251
  * ```
240
252
  *
241
253
  * @category pattern matching
@@ -248,13 +260,13 @@ const matchRight = exports.matchRight = /*#__PURE__*/(0, _Function.dual)(2, (sel
248
260
  /**
249
261
  * Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`.
250
262
  *
251
- * @example
263
+ * **Example**
264
+ *
252
265
  * ```ts
253
266
  * import { Array } from "effect"
254
267
  *
255
- * const original = [2, 3, 4];
256
- * const result = Array.prepend(original, 1);
257
- * assert.deepStrictEqual(result, [1, 2, 3, 4]);
268
+ * const result = Array.prepend([2, 3, 4], 1)
269
+ * console.log(result) // [1, 2, 3, 4]
258
270
  * ```
259
271
  *
260
272
  * @category concatenating
@@ -265,14 +277,13 @@ const prepend = exports.prepend = /*#__PURE__*/(0, _Function.dual)(2, (self, hea
265
277
  * Prepends the specified prefix array (or iterable) to the beginning of the specified array (or iterable).
266
278
  * If either array is non-empty, the result is also a non-empty array.
267
279
  *
268
- * @example
280
+ * **Example**
281
+ *
269
282
  * ```ts
270
283
  * import { Array } from "effect"
271
284
  *
272
- * const prefix = [0, 1];
273
- * const array = [2, 3];
274
- * const result = Array.prependAll(array, prefix);
275
- * assert.deepStrictEqual(result, [0, 1, 2, 3]);
285
+ * const result = Array.prependAll([2, 3], [0, 1])
286
+ * console.log(result) // [0, 1, 2, 3]
276
287
  * ```
277
288
  *
278
289
  * @category concatenating
@@ -282,13 +293,13 @@ const prependAll = exports.prependAll = /*#__PURE__*/(0, _Function.dual)(2, (sel
282
293
  /**
283
294
  * Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`.
284
295
  *
285
- * @example
296
+ * **Example**
297
+ *
286
298
  * ```ts
287
299
  * import { Array } from "effect"
288
300
  *
289
- * const original = [1, 2, 3];
290
- * const result = Array.append(original, 4);
291
- * assert.deepStrictEqual(result, [1, 2, 3, 4]);
301
+ * const result = Array.append([1, 2, 3], 4);
302
+ * console.log(result) // [1, 2, 3, 4]
292
303
  * ```
293
304
  *
294
305
  * @category concatenating
@@ -308,13 +319,13 @@ const appendAll = exports.appendAll = /*#__PURE__*/(0, _Function.dual)(2, (self,
308
319
  * each intermediate result in an array. Useful for tracking the progression of
309
320
  * a value through a series of transformations.
310
321
  *
311
- * @example
322
+ * **Example**
323
+ *
312
324
  * ```ts
313
325
  * import { Array } from "effect";
314
326
  *
315
- * const numbers = [1, 2, 3, 4]
316
- * const result = Array.scan(numbers, 0, (acc, value) => acc + value)
317
- * assert.deepStrictEqual(result, [0, 1, 3, 6, 10])
327
+ * const result = Array.scan([1, 2, 3, 4], 0, (acc, value) => acc + value)
328
+ * console.log(result) // [0, 1, 3, 6, 10]
318
329
  *
319
330
  * // Explanation:
320
331
  * // This function starts with the initial value (0 in this case)
@@ -340,13 +351,13 @@ const scan = exports.scan = /*#__PURE__*/(0, _Function.dual)(3, (self, b, f) =>
340
351
  * each intermediate result in an array. Useful for tracking the progression of
341
352
  * a value through a series of transformations.
342
353
  *
343
- * @example
354
+ * **Example**
355
+ *
344
356
  * ```ts
345
357
  * import { Array } from "effect";
346
358
  *
347
- * const numbers = [1, 2, 3, 4]
348
- * const result = Array.scanRight(numbers, 0, (acc, value) => acc + value)
349
- * assert.deepStrictEqual(result, [10, 9, 7, 4, 0])
359
+ * const result = Array.scanRight([1, 2, 3, 4], 0, (acc, value) => acc + value)
360
+ * console.log(result) // [10, 9, 7, 4, 0]
350
361
  * ```
351
362
  *
352
363
  * @category folding
@@ -364,14 +375,13 @@ const scanRight = exports.scanRight = /*#__PURE__*/(0, _Function.dual)(3, (self,
364
375
  /**
365
376
  * Determine if `unknown` is an Array.
366
377
  *
367
- * @param self - The value to check.
378
+ * **Example**
368
379
  *
369
- * @example
370
380
  * ```ts
371
- * import { isArray } from "effect/Array"
381
+ * import { Array } from "effect"
372
382
  *
373
- * assert.deepStrictEqual(isArray(null), false);
374
- * assert.deepStrictEqual(isArray([1, 2, 3]), true);
383
+ * console.log(Array.isArray(null)) // false
384
+ * console.log(Array.isArray([1, 2, 3])) // true
375
385
  * ```
376
386
  *
377
387
  * @category guards
@@ -381,14 +391,13 @@ const isArray = exports.isArray = Array.isArray;
381
391
  /**
382
392
  * Determine if an `Array` is empty narrowing down the type to `[]`.
383
393
  *
384
- * @param self - The `Array` to check.
394
+ * **Example**
385
395
  *
386
- * @example
387
396
  * ```ts
388
- * import { isEmptyArray } from "effect/Array"
397
+ * import { Array } from "effect"
389
398
  *
390
- * assert.deepStrictEqual(isEmptyArray([]), true);
391
- * assert.deepStrictEqual(isEmptyArray([1, 2, 3]), false);
399
+ * console.log(Array.isEmptyArray([])) // true
400
+ * console.log(Array.isEmptyArray([1, 2, 3])) // false
392
401
  * ```
393
402
  *
394
403
  * @category guards
@@ -398,14 +407,13 @@ const isEmptyArray = self => self.length === 0;
398
407
  /**
399
408
  * Determine if a `ReadonlyArray` is empty narrowing down the type to `readonly []`.
400
409
  *
401
- * @param self - The `ReadonlyArray` to check.
410
+ * **Example**
402
411
  *
403
- * @example
404
412
  * ```ts
405
- * import { isEmptyReadonlyArray } from "effect/Array"
413
+ * import { Array } from "effect"
406
414
  *
407
- * assert.deepStrictEqual(isEmptyReadonlyArray([]), true);
408
- * assert.deepStrictEqual(isEmptyReadonlyArray([1, 2, 3]), false);
415
+ * console.log(Array.isEmptyReadonlyArray([])) // true
416
+ * console.log(Array.isEmptyReadonlyArray([1, 2, 3])) // false
409
417
  * ```
410
418
  *
411
419
  * @category guards
@@ -418,14 +426,13 @@ const isEmptyReadonlyArray = exports.isEmptyReadonlyArray = isEmptyArray;
418
426
  *
419
427
  * An `Array` is considered to be a `NonEmptyArray` if it contains at least one element.
420
428
  *
421
- * @param self - The `Array` to check.
429
+ * **Example**
422
430
  *
423
- * @example
424
431
  * ```ts
425
- * import { isNonEmptyArray } from "effect/Array"
432
+ * import { Array } from "effect"
426
433
  *
427
- * assert.deepStrictEqual(isNonEmptyArray([]), false);
428
- * assert.deepStrictEqual(isNonEmptyArray([1, 2, 3]), true);
434
+ * console.log(Array.isNonEmptyArray([])) // false
435
+ * console.log(Array.isNonEmptyArray([1, 2, 3])) // true
429
436
  * ```
430
437
  *
431
438
  * @category guards
@@ -437,14 +444,13 @@ const isNonEmptyArray = exports.isNonEmptyArray = readonlyArray.isNonEmptyArray;
437
444
  *
438
445
  * A `ReadonlyArray` is considered to be a `NonEmptyReadonlyArray` if it contains at least one element.
439
446
  *
440
- * @param self - The `ReadonlyArray` to check.
447
+ * **Example**
441
448
  *
442
- * @example
443
449
  * ```ts
444
- * import { isNonEmptyReadonlyArray } from "effect/Array"
450
+ * import { Array } from "effect"
445
451
  *
446
- * assert.deepStrictEqual(isNonEmptyReadonlyArray([]), false);
447
- * assert.deepStrictEqual(isNonEmptyReadonlyArray([1, 2, 3]), true);
452
+ * console.log(Array.isNonEmptyReadonlyArray([])) // false
453
+ * console.log(Array.isNonEmptyReadonlyArray([1, 2, 3])) // true
448
454
  * ```
449
455
  *
450
456
  * @category guards
@@ -487,12 +493,13 @@ const unsafeGet = exports.unsafeGet = /*#__PURE__*/(0, _Function.dual)(2, (self,
487
493
  /**
488
494
  * Return a tuple containing the first element, and a new `Array` of the remaining elements, if any.
489
495
  *
490
- * @example
496
+ * **Example**
497
+ *
491
498
  * ```ts
492
499
  * import { Array } from "effect";
493
500
  *
494
501
  * const result = Array.unprepend([1, 2, 3, 4])
495
- * assert.deepStrictEqual(result, [1, [2, 3, 4]])
502
+ * console.log(result) // [1, [2, 3, 4]]
496
503
  * ```
497
504
  *
498
505
  * @category splitting
@@ -502,12 +509,13 @@ const unprepend = self => [headNonEmpty(self), tailNonEmpty(self)];
502
509
  /**
503
510
  * Return a tuple containing a copy of the `NonEmptyReadonlyArray` without its last element, and that last element.
504
511
  *
505
- * @example
512
+ * **Example**
513
+ *
506
514
  * ```ts
507
515
  * import { Array } from "effect";
508
516
  *
509
517
  * const result = Array.unappend([1, 2, 3, 4])
510
- * assert.deepStrictEqual(result, [[1, 2, 3], 4])
518
+ * console.log(result) // [[1, 2, 3], 4]
511
519
  * ```
512
520
  *
513
521
  * @category splitting
@@ -526,12 +534,13 @@ const head = exports.head = /*#__PURE__*/get(0);
526
534
  /**
527
535
  * Get the first element of a non empty array.
528
536
  *
529
- * @example
537
+ * **Example**
538
+ *
530
539
  * ```ts
531
540
  * import { Array } from "effect"
532
541
  *
533
542
  * const result = Array.headNonEmpty([1, 2, 3, 4])
534
- * assert.deepStrictEqual(result, 1)
543
+ * console.log(result) // 1
535
544
  * ```
536
545
  *
537
546
  * @category getters
@@ -548,12 +557,13 @@ const last = self => isNonEmptyReadonlyArray(self) ? O.some(lastNonEmpty(self))
548
557
  /**
549
558
  * Get the last element of a non empty array.
550
559
  *
551
- * @example
560
+ * **Example**
561
+ *
552
562
  * ```ts
553
563
  * import { Array } from "effect"
554
564
  *
555
565
  * const result = Array.lastNonEmpty([1, 2, 3, 4])
556
- * assert.deepStrictEqual(result, 4)
566
+ * console.log(result) // 4
557
567
  * ```
558
568
  *
559
569
  * @category getters
@@ -575,12 +585,13 @@ const tail = self => {
575
585
  /**
576
586
  * Get all but the first element of a `NonEmptyReadonlyArray`.
577
587
  *
578
- * @example
588
+ * **Example**
589
+ *
579
590
  * ```ts
580
591
  * import { Array } from "effect"
581
592
  *
582
593
  * const result = Array.tailNonEmpty([1, 2, 3, 4])
583
- * assert.deepStrictEqual(result, [2, 3, 4])
594
+ * console.log(result) // [2, 3, 4]
584
595
  * ```
585
596
  *
586
597
  * @category getters
@@ -602,12 +613,13 @@ const init = self => {
602
613
  /**
603
614
  * Get all but the last element of a non empty array, creating a new array.
604
615
  *
605
- * @example
616
+ * **Example**
617
+ *
606
618
  * ```ts
607
619
  * import { Array } from "effect"
608
620
  *
609
621
  * const result = Array.initNonEmpty([1, 2, 3, 4])
610
- * assert.deepStrictEqual(result, [1, 2, 3])
622
+ * console.log(result) // [1, 2, 3]
611
623
  * ```
612
624
  *
613
625
  * @category getters
@@ -620,13 +632,13 @@ const initNonEmpty = self => self.slice(0, -1);
620
632
  *
621
633
  * **Note**. `n` is normalized to a non negative integer.
622
634
  *
623
- * @example
635
+ * **Example**
636
+ *
624
637
  * ```ts
625
638
  * import { Array } from "effect"
626
639
  *
627
- * const numbers = [1, 2, 3, 4, 5]
628
- * const result = Array.take(numbers, 3)
629
- * assert.deepStrictEqual(result, [1, 2, 3])
640
+ * const result = Array.take([1, 2, 3, 4, 5], 3)
641
+ * console.log(result) // [1, 2, 3]
630
642
  * ```
631
643
  *
632
644
  * @category getters
@@ -642,13 +654,13 @@ const take = exports.take = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => {
642
654
  *
643
655
  * **Note**. `n` is normalized to a non negative integer.
644
656
  *
645
- * @example
657
+ * **Example**
658
+ *
646
659
  * ```ts
647
660
  * import { Array } from "effect"
648
661
  *
649
- * const numbers = [1, 2, 3, 4, 5]
650
- * const result = Array.takeRight(numbers, 3)
651
- * assert.deepStrictEqual(result, [3, 4, 5])
662
+ * const result = Array.takeRight([1, 2, 3, 4, 5], 3)
663
+ * console.log(result) // [3, 4, 5]
652
664
  * ```
653
665
  *
654
666
  * @category getters
@@ -662,13 +674,13 @@ const takeRight = exports.takeRight = /*#__PURE__*/(0, _Function.dual)(2, (self,
662
674
  /**
663
675
  * Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
664
676
  *
665
- * @example
677
+ * **Example**
678
+ *
666
679
  * ```ts
667
680
  * import { Array } from "effect"
668
681
  *
669
- * const numbers = [1, 3, 2, 4, 1, 2]
670
- * const result = Array.takeWhile(numbers, x => x < 4)
671
- * assert.deepStrictEqual(result, [1, 3, 2])
682
+ * const result = Array.takeWhile([1, 3, 2, 4, 1, 2], x => x < 4)
683
+ * console.log(result) // [1, 3, 2]
672
684
  *
673
685
  * // Explanation:
674
686
  * // - The function starts with the first element (`1`), which is less than `4`, so it adds `1` to the result.
@@ -717,13 +729,13 @@ const span = exports.span = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate
717
729
  *
718
730
  * **Note**. `n` is normalized to a non negative integer.
719
731
  *
720
- * @example
732
+ * **Example**
733
+ *
721
734
  * ```ts
722
735
  * import { Array } from "effect"
723
736
  *
724
- * const numbers = [1, 2, 3, 4, 5]
725
- * const result = Array.drop(numbers, 2)
726
- * assert.deepStrictEqual(result, [3, 4, 5])
737
+ * const result = Array.drop([1, 2, 3, 4, 5], 2)
738
+ * console.log(result) // [3, 4, 5]
727
739
  * ```
728
740
  *
729
741
  * @category getters
@@ -738,13 +750,13 @@ const drop = exports.drop = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => {
738
750
  *
739
751
  * **Note**. `n` is normalized to a non negative integer.
740
752
  *
741
- * @example
753
+ * **Example**
754
+ *
742
755
  * ```ts
743
756
  * import { Array } from "effect"
744
757
  *
745
- * const numbers = [1, 2, 3, 4, 5]
746
- * const result = Array.dropRight(numbers, 2)
747
- * assert.deepStrictEqual(result, [1, 2, 3])
758
+ * const result = Array.dropRight([1, 2, 3, 4, 5], 2)
759
+ * console.log(result) // [1, 2, 3]
748
760
  * ```
749
761
  *
750
762
  * @category getters
@@ -757,13 +769,13 @@ const dropRight = exports.dropRight = /*#__PURE__*/(0, _Function.dual)(2, (self,
757
769
  /**
758
770
  * Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
759
771
  *
760
- * @example
772
+ * **Example**
773
+ *
761
774
  * ```ts
762
775
  * import { Array } from "effect"
763
776
  *
764
- * const numbers = [1, 2, 3, 4, 5]
765
- * const result = Array.dropWhile(numbers, x => x < 4)
766
- * assert.deepStrictEqual(result, [4, 5])
777
+ * const result = Array.dropWhile([1, 2, 3, 4, 5], x => x < 4)
778
+ * console.log(result) // [4, 5]
767
779
  * ```
768
780
  *
769
781
  * @category getters
@@ -773,13 +785,13 @@ const dropWhile = exports.dropWhile = /*#__PURE__*/(0, _Function.dual)(2, (self,
773
785
  /**
774
786
  * Return the first index for which a predicate holds.
775
787
  *
776
- * @example
788
+ * **Example**
789
+ *
777
790
  * ```ts
778
- * import { Array, Option } from "effect"
791
+ * import { Array } from "effect"
779
792
  *
780
- * const numbers = [5, 3, 8, 9]
781
- * const result = Array.findFirstIndex(numbers, x => x > 5)
782
- * assert.deepStrictEqual(result, Option.some(2))
793
+ * const result = Array.findFirstIndex([5, 3, 8, 9], x => x > 5)
794
+ * console.log(result) // Option.some(2)
783
795
  * ```
784
796
  *
785
797
  * @category elements
@@ -798,13 +810,13 @@ const findFirstIndex = exports.findFirstIndex = /*#__PURE__*/(0, _Function.dual)
798
810
  /**
799
811
  * Return the last index for which a predicate holds.
800
812
  *
801
- * @example
813
+ * **Example**
814
+ *
802
815
  * ```ts
803
- * import { Array, Option } from "effect"
816
+ * import { Array } from "effect"
804
817
  *
805
- * const numbers = [1, 3, 8, 9]
806
- * const result = Array.findLastIndex(numbers, x => x < 5)
807
- * assert.deepStrictEqual(result, Option.some(1))
818
+ * const result = Array.findLastIndex([1, 3, 8, 9], x => x < 5)
819
+ * console.log(result) // Option.some(1)
808
820
  * ```
809
821
  *
810
822
  * @category elements
@@ -823,13 +835,13 @@ const findLastIndex = exports.findLastIndex = /*#__PURE__*/(0, _Function.dual)(2
823
835
  * Returns the first element that satisfies the specified
824
836
  * predicate, or `None` if no such element exists.
825
837
  *
826
- * @example
838
+ * **Example**
839
+ *
827
840
  * ```ts
828
- * import { Array, Option } from "effect"
841
+ * import { Array } from "effect"
829
842
  *
830
- * const numbers = [1, 2, 3, 4, 5]
831
- * const result = Array.findFirst(numbers, x => x > 3)
832
- * assert.deepStrictEqual(result, Option.some(4))
843
+ * const result = Array.findFirst([1, 2, 3, 4, 5], x => x > 3)
844
+ * console.log(result) // Option.some(4)
833
845
  * ```
834
846
  *
835
847
  * @category elements
@@ -840,13 +852,13 @@ const findFirst = exports.findFirst = EffectIterable.findFirst;
840
852
  * Finds the last element in an iterable collection that satisfies the given predicate or refinement.
841
853
  * Returns an `Option` containing the found element, or `Option.none` if no element matches.
842
854
  *
843
- * @example
855
+ * **Example**
856
+ *
844
857
  * ```ts
845
- * import { Array, Option } from "effect"
858
+ * import { Array } from "effect"
846
859
  *
847
- * const numbers = [1, 2, 3, 4, 5]
848
- * const result = Array.findLast(numbers, n => n % 2 === 0)
849
- * assert.deepStrictEqual(result, Option.some(4))
860
+ * const result = Array.findLast([1, 2, 3, 4, 5], n => n % 2 === 0)
861
+ * console.log(result) // Option.some(4)
850
862
  * ```
851
863
  *
852
864
  * @category elements
@@ -873,13 +885,13 @@ const findLast = exports.findLast = /*#__PURE__*/(0, _Function.dual)(2, (self, f
873
885
  * Insert an element at the specified index, creating a new `NonEmptyArray`,
874
886
  * or return `None` if the index is out of bounds.
875
887
  *
876
- * @example
888
+ * **Example**
889
+ *
877
890
  * ```ts
878
- * import { Array, Option } from "effect"
891
+ * import { Array } from "effect"
879
892
  *
880
- * const letters = ['a', 'b', 'c', 'e']
881
- * const result = Array.insertAt(letters, 3, 'd')
882
- * assert.deepStrictEqual(result, Option.some(['a', 'b', 'c', 'd', 'e']))
893
+ * const result = Array.insertAt(['a', 'b', 'c', 'e'], 3, 'd')
894
+ * console.log(result) // Option.some(['a', 'b', 'c', 'd', 'e'])
883
895
  * ```
884
896
  *
885
897
  * @since 2.0.0
@@ -897,13 +909,13 @@ const insertAt = exports.insertAt = /*#__PURE__*/(0, _Function.dual)(3, (self, i
897
909
  * Change the element at the specified index, creating a new `Array`,
898
910
  * or return a copy of the input if the index is out of bounds.
899
911
  *
900
- * @example
912
+ * **Example**
913
+ *
901
914
  * ```ts
902
915
  * import { Array } from "effect"
903
916
  *
904
- * const letters = ['a', 'b', 'c', 'd']
905
- * const result = Array.replace(letters, 1, 'z')
906
- * assert.deepStrictEqual(result, ['a', 'z', 'c', 'd'])
917
+ * const result = Array.replace(['a', 'b', 'c', 'd'], 1, 'z')
918
+ * console.log(result) // ['a', 'z', 'c', 'd']
907
919
  * ```
908
920
  *
909
921
  * @since 2.0.0
@@ -912,13 +924,13 @@ const replace = exports.replace = /*#__PURE__*/(0, _Function.dual)(3, (self, i,
912
924
  /**
913
925
  * Replaces an element in an array with the given value, returning an option of the updated array.
914
926
  *
915
- * @example
927
+ * **Example**
928
+ *
916
929
  * ```ts
917
- * import { Array, Option } from "effect"
930
+ * import { Array } from "effect"
918
931
  *
919
- * const numbers = [1, 2, 3]
920
- * const result = Array.replaceOption(numbers, 1, 4)
921
- * assert.deepStrictEqual(result, Option.some([1, 4, 3]))
932
+ * const result = Array.replaceOption([1, 2, 3], 1, 4)
933
+ * console.log(result) // Option.some([1, 4, 3])
922
934
  * ```
923
935
  *
924
936
  * @since 2.0.0
@@ -928,13 +940,13 @@ const replaceOption = exports.replaceOption = /*#__PURE__*/(0, _Function.dual)(3
928
940
  * Apply a function to the element at the specified index, creating a new `Array`,
929
941
  * or return a copy of the input if the index is out of bounds.
930
942
  *
931
- * @example
943
+ * **Example**
944
+ *
932
945
  * ```ts
933
946
  * import { Array } from "effect"
934
947
  *
935
- * const numbers = [1, 2, 3, 4]
936
- * const result = Array.modify(numbers, 2, (n) => n * 2)
937
- * assert.deepStrictEqual(result, [1, 2, 6, 4])
948
+ * const result = Array.modify([1, 2, 3, 4], 2, (n) => n * 2)
949
+ * console.log(result) // [1, 2, 6, 4]
938
950
  * ```
939
951
  *
940
952
  * @since 2.0.0
@@ -944,16 +956,17 @@ const modify = exports.modify = /*#__PURE__*/(0, _Function.dual)(3, (self, i, f)
944
956
  * Apply a function to the element at the specified index, creating a new `Array`,
945
957
  * or return `None` if the index is out of bounds.
946
958
  *
947
- * @example
959
+ * **Example**
960
+ *
948
961
  * ```ts
949
- * import { Array, Option } from "effect"
962
+ * import { Array } from "effect"
950
963
  *
951
- * const numbers = [1, 2, 3, 4]
952
- * const result = Array.modifyOption(numbers, 2, (n) => n * 2)
953
- * assert.deepStrictEqual(result, Option.some([1, 2, 6, 4]))
964
+ * const input = [1, 2, 3, 4]
965
+ * const result = Array.modifyOption(input, 2, (n) => n * 2)
966
+ * console.log(result) // Option.some([1, 2, 6, 4])
954
967
  *
955
- * const outOfBoundsResult = Array.modifyOption(numbers, 5, (n) => n * 2)
956
- * assert.deepStrictEqual(outOfBoundsResult, Option.none())
968
+ * const outOfBoundsResult = Array.modifyOption(input, 5, (n) => n * 2)
969
+ * console.log(outOfBoundsResult) // Option.none()
957
970
  * ```
958
971
  *
959
972
  * @since 2.0.0
@@ -972,16 +985,17 @@ const modifyOption = exports.modifyOption = /*#__PURE__*/(0, _Function.dual)(3,
972
985
  * Delete the element at the specified index, creating a new `Array`,
973
986
  * or return a copy of the input if the index is out of bounds.
974
987
  *
975
- * @example
988
+ * **Example**
989
+ *
976
990
  * ```ts
977
991
  * import { Array } from "effect"
978
992
  *
979
- * const numbers = [1, 2, 3, 4]
980
- * const result = Array.remove(numbers, 2)
981
- * assert.deepStrictEqual(result, [1, 2, 4])
993
+ * const input = [1, 2, 3, 4]
994
+ * const result = Array.remove(input, 2)
995
+ * console.log(result) // [1, 2, 4]
982
996
  *
983
- * const outOfBoundsResult = Array.remove(numbers, 5)
984
- * assert.deepStrictEqual(outOfBoundsResult, [1, 2, 3, 4])
997
+ * const outOfBoundsResult = Array.remove(input, 5)
998
+ * console.log(outOfBoundsResult) // [1, 2, 3, 4]
985
999
  * ```
986
1000
  *
987
1001
  * @since 2.0.0
@@ -997,13 +1011,13 @@ const remove = exports.remove = /*#__PURE__*/(0, _Function.dual)(2, (self, i) =>
997
1011
  /**
998
1012
  * Reverse an `Iterable`, creating a new `Array`.
999
1013
  *
1000
- * @example
1014
+ * **Example**
1015
+ *
1001
1016
  * ```ts
1002
1017
  * import { Array } from "effect"
1003
1018
  *
1004
- * const numbers = [1, 2, 3, 4]
1005
- * const result = Array.reverse(numbers)
1006
- * assert.deepStrictEqual(result, [4, 3, 2, 1])
1019
+ * const result = Array.reverse([1, 2, 3, 4])
1020
+ * console.log(result) // [4, 3, 2, 1]
1007
1021
  * ```
1008
1022
  *
1009
1023
  * @category elements
@@ -1028,13 +1042,13 @@ const sort = exports.sort = /*#__PURE__*/(0, _Function.dual)(2, (self, O) => {
1028
1042
  * function transforms the elements into a value that can be compared, and the
1029
1043
  * order defines how those values should be sorted.
1030
1044
  *
1031
- * @example
1045
+ * **Example**
1046
+ *
1032
1047
  * ```ts
1033
1048
  * import { Array, Order } from "effect"
1034
1049
  *
1035
- * const strings = ["aaa", "b", "cc"]
1036
- * const result = Array.sortWith(strings, (s) => s.length, Order.number)
1037
- * assert.deepStrictEqual(result, ["b", "cc", "aaa"])
1050
+ * const result = Array.sortWith(["aaa", "b", "cc"], (s) => s.length, Order.number)
1051
+ * console.log(result) // ["b", "cc", "aaa"]
1038
1052
  *
1039
1053
  * // Explanation:
1040
1054
  * // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
@@ -1051,9 +1065,10 @@ const sortWith = exports.sortWith = /*#__PURE__*/(0, _Function.dual)(3, (self, f
1051
1065
  * orders. The elements are compared using the first order in `orders`, then the
1052
1066
  * second order if the first comparison is equal, and so on.
1053
1067
  *
1054
- * @example
1068
+ * **Example**
1069
+ *
1055
1070
  * ```ts
1056
- * import { Array, Order } from "effect"
1071
+ * import { Array, Order, pipe } from "effect"
1057
1072
  *
1058
1073
  * const users = [
1059
1074
  * { name: "Alice", age: 30 },
@@ -1061,16 +1076,20 @@ const sortWith = exports.sortWith = /*#__PURE__*/(0, _Function.dual)(3, (self, f
1061
1076
  * { name: "Charlie", age: 30 }
1062
1077
  * ]
1063
1078
  *
1064
- * const result = Array.sortBy(
1065
- * Order.mapInput(Order.number, (user: (typeof users)[number]) => user.age),
1066
- * Order.mapInput(Order.string, (user: (typeof users)[number]) => user.name)
1067
- * )(users)
1079
+ * const result = pipe(
1080
+ * users,
1081
+ * Array.sortBy(
1082
+ * Order.mapInput(Order.number, (user: (typeof users)[number]) => user.age),
1083
+ * Order.mapInput(Order.string, (user: (typeof users)[number]) => user.name)
1084
+ * )
1085
+ * )
1068
1086
  *
1069
- * assert.deepStrictEqual(result, [
1070
- * { name: "Bob", age: 25 },
1071
- * { name: "Alice", age: 30 },
1072
- * { name: "Charlie", age: 30 }
1073
- * ])
1087
+ * console.log(result)
1088
+ * // [
1089
+ * // { name: "Bob", age: 25 },
1090
+ * // { name: "Alice", age: 30 },
1091
+ * // { name: "Charlie", age: 30 }
1092
+ * // ]
1074
1093
  *
1075
1094
  * // Explanation:
1076
1095
  * // The array of users is sorted first by age in ascending order. When ages are equal,
@@ -1095,14 +1114,13 @@ const sortBy = (...orders) => {
1095
1114
  * If one input `Iterable` is short, excess elements of the
1096
1115
  * longer `Iterable` are discarded.
1097
1116
  *
1098
- * @example
1117
+ * **Example**
1118
+ *
1099
1119
  * ```ts
1100
1120
  * import { Array } from "effect"
1101
1121
  *
1102
- * const array1 = [1, 2, 3]
1103
- * const array2 = ['a', 'b']
1104
- * const result = Array.zip(array1, array2)
1105
- * assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
1122
+ * const result = Array.zip([1, 2, 3], ['a', 'b'])
1123
+ * console.log(result) // [[1, 'a'], [2, 'b']]
1106
1124
  * ```
1107
1125
  *
1108
1126
  * @category zipping
@@ -1114,14 +1132,13 @@ const zip = exports.zip = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => zi
1114
1132
  * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
1115
1133
  * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
1116
1134
  *
1117
- * @example
1135
+ * **Example**
1136
+ *
1118
1137
  * ```ts
1119
1138
  * import { Array } from "effect"
1120
1139
  *
1121
- * const array1 = [1, 2, 3]
1122
- * const array2 = [4, 5, 6]
1123
- * const result = Array.zipWith(array1, array2, (a, b) => a + b)
1124
- * assert.deepStrictEqual(result, [5, 7, 9])
1140
+ * const result = Array.zipWith([1, 2, 3], [4, 5, 6], (a, b) => a + b)
1141
+ * console.log(result) // [5, 7, 9]
1125
1142
  * ```
1126
1143
  *
1127
1144
  * @category zipping
@@ -1143,12 +1160,13 @@ const zipWith = exports.zipWith = /*#__PURE__*/(0, _Function.dual)(3, (self, tha
1143
1160
  /**
1144
1161
  * This function is the inverse of `zip`. Takes an `Iterable` of pairs and return two corresponding `Array`s.
1145
1162
  *
1146
- * @example
1163
+ * **Example**
1164
+ *
1147
1165
  * ```ts
1148
1166
  * import { Array } from "effect"
1149
1167
  *
1150
1168
  * const result = Array.unzip([[1, "a"], [2, "b"], [3, "c"]])
1151
- * assert.deepStrictEqual(result, [[1, 2, 3], ['a', 'b', 'c']])
1169
+ * console.log(result) // [[1, 2, 3], ['a', 'b', 'c']]
1152
1170
  * ```
1153
1171
  *
1154
1172
  * @since 2.0.0
@@ -1170,13 +1188,13 @@ const unzip = self => {
1170
1188
  * Places an element in between members of an `Iterable`.
1171
1189
  * If the input is a non-empty array, the result is also a non-empty array.
1172
1190
  *
1173
- * @example
1191
+ * **Example**
1192
+ *
1174
1193
  * ```ts
1175
1194
  * import { Array } from "effect"
1176
1195
  *
1177
- * const numbers = [1, 2, 3]
1178
- * const result = Array.intersperse(numbers, 0)
1179
- * assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
1196
+ * const result = Array.intersperse([1, 2, 3], 0)
1197
+ * console.log(result) // [1, 0, 2, 0, 3]
1180
1198
  * ```
1181
1199
  *
1182
1200
  * @since 2.0.0
@@ -1200,12 +1218,13 @@ const intersperse = exports.intersperse = /*#__PURE__*/(0, _Function.dual)(2, (s
1200
1218
  /**
1201
1219
  * Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
1202
1220
  *
1203
- * @example
1221
+ * **Example**
1222
+ *
1204
1223
  * ```ts
1205
1224
  * import { Array } from "effect"
1206
1225
  *
1207
1226
  * const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10)
1208
- * assert.deepStrictEqual(result, [10, 2, 3])
1227
+ * console.log(result) // [10, 2, 3]
1209
1228
  * ```
1210
1229
  *
1211
1230
  * @since 2.0.0
@@ -1214,12 +1233,13 @@ const modifyNonEmptyHead = exports.modifyNonEmptyHead = /*#__PURE__*/(0, _Functi
1214
1233
  /**
1215
1234
  * Change the head, creating a new `NonEmptyReadonlyArray`.
1216
1235
  *
1217
- * @example
1236
+ * **Example**
1237
+ *
1218
1238
  * ```ts
1219
1239
  * import { Array } from "effect"
1220
1240
  *
1221
1241
  * const result = Array.setNonEmptyHead([1, 2, 3], 10)
1222
- * assert.deepStrictEqual(result, [10, 2, 3])
1242
+ * console.log(result) // [10, 2, 3]
1223
1243
  * ```
1224
1244
  *
1225
1245
  * @since 2.0.0
@@ -1228,12 +1248,13 @@ const setNonEmptyHead = exports.setNonEmptyHead = /*#__PURE__*/(0, _Function.dua
1228
1248
  /**
1229
1249
  * Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
1230
1250
  *
1231
- * @example
1251
+ * **Example**
1252
+ *
1232
1253
  * ```ts
1233
1254
  * import { Array } from "effect"
1234
1255
  *
1235
1256
  * const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2)
1236
- * assert.deepStrictEqual(result, [1, 2, 6])
1257
+ * console.log(result) // [1, 2, 6]
1237
1258
  * ```
1238
1259
  *
1239
1260
  * @since 2.0.0
@@ -1242,12 +1263,13 @@ const modifyNonEmptyLast = exports.modifyNonEmptyLast = /*#__PURE__*/(0, _Functi
1242
1263
  /**
1243
1264
  * Change the last element, creating a new `NonEmptyReadonlyArray`.
1244
1265
  *
1245
- * @example
1266
+ * **Example**
1267
+ *
1246
1268
  * ```ts
1247
1269
  * import { Array } from "effect"
1248
1270
  *
1249
1271
  * const result = Array.setNonEmptyLast([1, 2, 3], 4)
1250
- * assert.deepStrictEqual(result, [1, 2, 4])
1272
+ * console.log(result) // [1, 2, 4]
1251
1273
  * ```
1252
1274
  *
1253
1275
  * @since 2.0.0
@@ -1257,13 +1279,13 @@ const setNonEmptyLast = exports.setNonEmptyLast = /*#__PURE__*/(0, _Function.dua
1257
1279
  * Rotate an `Iterable` by `n` steps.
1258
1280
  * If the input is a non-empty array, the result is also a non-empty array.
1259
1281
  *
1260
- * @example
1282
+ * **Example**
1283
+ *
1261
1284
  * ```ts
1262
1285
  * import { Array } from "effect"
1263
1286
  *
1264
- * const letters = ['a', 'b', 'c', 'd']
1265
- * const result = Array.rotate(letters, 2)
1266
- * assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
1287
+ * const result = Array.rotate(['a', 'b', 'c', 'd'], 2)
1288
+ * console.log(result) // ['c', 'd', 'a', 'b']
1267
1289
  * ```
1268
1290
  *
1269
1291
  * @since 2.0.0
@@ -1288,15 +1310,15 @@ const rotate = exports.rotate = /*#__PURE__*/(0, _Function.dual)(2, (self, n) =>
1288
1310
  /**
1289
1311
  * Returns a function that checks if a `ReadonlyArray` contains a given value using a provided `isEquivalent` function.
1290
1312
  *
1291
- * @example
1313
+ * **Example**
1314
+ *
1292
1315
  * ```ts
1293
- * import { Array } from "effect"
1316
+ * import { Array, pipe } from "effect"
1294
1317
  *
1295
- * const numbers = [1, 2, 3, 4]
1296
1318
  * const isEquivalent = (a: number, b: number) => a === b
1297
1319
  * const containsNumber = Array.containsWith(isEquivalent)
1298
- * const result = containsNumber(3)(numbers)
1299
- * assert.deepStrictEqual(result, true)
1320
+ * const result = pipe([1, 2, 3, 4], containsNumber(3))
1321
+ * console.log(result) // true
1300
1322
  * ```
1301
1323
  *
1302
1324
  * @category elements
@@ -1315,13 +1337,13 @@ const _equivalence = /*#__PURE__*/Equal.equivalence();
1315
1337
  /**
1316
1338
  * Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`.
1317
1339
  *
1318
- * @example
1340
+ * **Example**
1341
+ *
1319
1342
  * ```ts
1320
- * import { Array } from "effect"
1343
+ * import { Array, pipe } from "effect"
1321
1344
  *
1322
- * const letters = ['a', 'b', 'c', 'd']
1323
- * const result = Array.contains('c')(letters)
1324
- * assert.deepStrictEqual(result, true)
1345
+ * const result = pipe(['a', 'b', 'c', 'd'], Array.contains('c'))
1346
+ * console.log(result) // true
1325
1347
  * ```
1326
1348
  *
1327
1349
  * @category elements
@@ -1333,13 +1355,13 @@ const contains = exports.contains = /*#__PURE__*/containsWith(_equivalence);
1333
1355
  * `Iterable`. Typically chop is called with some function that will consume an initial prefix of the `Iterable` and produce a
1334
1356
  * value and the rest of the `Array`.
1335
1357
  *
1336
- * @example
1358
+ * **Example**
1359
+ *
1337
1360
  * ```ts
1338
1361
  * import { Array } from "effect"
1339
1362
  *
1340
- * const numbers = [1, 2, 3, 4, 5]
1341
- * const result = Array.chop(numbers, (as): [number, Array<number>] => [as[0] * 2, as.slice(1)])
1342
- * assert.deepStrictEqual(result, [2, 4, 6, 8, 10])
1363
+ * const result = Array.chop([1, 2, 3, 4, 5], (as): [number, Array<number>] => [as[0] * 2, as.slice(1)])
1364
+ * console.log(result) // [2, 4, 6, 8, 10]
1343
1365
  *
1344
1366
  * // Explanation:
1345
1367
  * // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
@@ -1368,13 +1390,13 @@ const chop = exports.chop = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => {
1368
1390
  * Splits an `Iterable` into two segments, with the first segment containing a maximum of `n` elements.
1369
1391
  * The value of `n` can be `0`.
1370
1392
  *
1371
- * @example
1393
+ * **Example**
1394
+ *
1372
1395
  * ```ts
1373
1396
  * import { Array } from "effect"
1374
1397
  *
1375
- * const numbers = [1, 2, 3, 4, 5]
1376
- * const result = Array.splitAt(numbers, 3)
1377
- * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
1398
+ * const result = Array.splitAt([1, 2, 3, 4, 5], 3)
1399
+ * console.log(result) // [[1, 2, 3], [4, 5]]
1378
1400
  * ```
1379
1401
  *
1380
1402
  * @category splitting
@@ -1395,12 +1417,13 @@ const splitAt = exports.splitAt = /*#__PURE__*/(0, _Function.dual)(2, (self, n)
1395
1417
  * Splits a `NonEmptyReadonlyArray` into two segments, with the first segment containing a maximum of `n` elements.
1396
1418
  * The value of `n` must be `>= 1`.
1397
1419
  *
1398
- * @example
1420
+ * **Example**
1421
+ *
1399
1422
  * ```ts
1400
1423
  * import { Array } from "effect"
1401
1424
  *
1402
1425
  * const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3)
1403
- * assert.deepStrictEqual(result, [["a", "b", "c"], ["d", "e"]])
1426
+ * console.log(result) // [["a", "b", "c"], ["d", "e"]]
1404
1427
  * ```
1405
1428
  *
1406
1429
  * @category splitting
@@ -1413,13 +1436,13 @@ const splitNonEmptyAt = exports.splitNonEmptyAt = /*#__PURE__*/(0, _Function.dua
1413
1436
  /**
1414
1437
  * Splits this iterable into `n` equally sized arrays.
1415
1438
  *
1416
- * @example
1439
+ * **Example**
1440
+ *
1417
1441
  * ```ts
1418
1442
  * import { Array } from "effect"
1419
1443
  *
1420
- * const numbers = [1, 2, 3, 4, 5, 6, 7, 8]
1421
- * const result = Array.split(numbers, 3)
1422
- * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5, 6], [7, 8]])
1444
+ * const result = Array.split([1, 2, 3, 4, 5, 6, 7, 8], 3)
1445
+ * console.log(result) // [[1, 2, 3], [4, 5, 6], [7, 8]]
1423
1446
  * ```
1424
1447
  *
1425
1448
  * @since 2.0.0
@@ -1433,13 +1456,13 @@ const split = exports.split = /*#__PURE__*/(0, _Function.dual)(2, (self, n) => {
1433
1456
  * Splits this iterable on the first element that matches this predicate.
1434
1457
  * Returns a tuple containing two arrays: the first one is before the match, and the second one is from the match onward.
1435
1458
  *
1436
- * @example
1459
+ * **Example**
1460
+ *
1437
1461
  * ```ts
1438
1462
  * import { Array } from "effect"
1439
1463
  *
1440
- * const numbers = [1, 2, 3, 4, 5]
1441
- * const result = Array.splitWhere(numbers, n => n > 3)
1442
- * assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
1464
+ * const result = Array.splitWhere([1, 2, 3, 4, 5], n => n > 3)
1465
+ * console.log(result) // [[1, 2, 3], [4, 5]]
1443
1466
  * ```
1444
1467
  *
1445
1468
  * @category splitting
@@ -1449,13 +1472,13 @@ const splitWhere = exports.splitWhere = /*#__PURE__*/(0, _Function.dual)(2, (sel
1449
1472
  /**
1450
1473
  * Copies an array.
1451
1474
  *
1452
- * @example
1475
+ * **Example**
1476
+ *
1453
1477
  * ```ts
1454
1478
  * import { Array } from "effect"
1455
1479
  *
1456
- * const numbers = [1, 2, 3]
1457
- * const copy = Array.copy(numbers)
1458
- * assert.deepStrictEqual(copy, [1, 2, 3])
1480
+ * const result = Array.copy([1, 2, 3])
1481
+ * console.log(result) // [1, 2, 3]
1459
1482
  * ```
1460
1483
  *
1461
1484
  * @since 2.0.0
@@ -1467,13 +1490,13 @@ const copy = self => self.slice();
1467
1490
  * If `array` is longer than `n`, the returned array will be a slice of `array` containing the `n` first elements of `array`.
1468
1491
  * If `n` is less than or equal to 0, the returned array will be an empty array.
1469
1492
  *
1470
- * @example
1493
+ * **Example**
1494
+ *
1471
1495
  * ```ts
1472
1496
  * import { Array } from "effect"
1473
1497
  *
1474
- * const arr = [1, 2, 3]
1475
- * const result = Array.pad(arr, 6, 0)
1476
- * assert.deepStrictEqual(result, [1, 2, 3, 0, 0, 0])
1498
+ * const result = Array.pad([1, 2, 3], 6, 0)
1499
+ * console.log(result) // [1, 2, 3, 0, 0, 0]
1477
1500
  * ```
1478
1501
  *
1479
1502
  * @since 3.8.4
@@ -1490,19 +1513,19 @@ const pad = exports.pad = /*#__PURE__*/(0, _Function.dual)(3, (self, n, fill) =>
1490
1513
  * the `Iterable`. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive
1491
1514
  * definition of `chunksOf`; it satisfies the property that
1492
1515
  *
1493
- * ```ts
1516
+ * ```ts skip-type-checking
1494
1517
  * chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys)))
1495
1518
  * ```
1496
1519
  *
1497
1520
  * whenever `n` evenly divides the length of `self`.
1498
1521
  *
1499
- * @example
1522
+ * **Example**
1523
+ *
1500
1524
  * ```ts
1501
1525
  * import { Array } from "effect"
1502
1526
  *
1503
- * const numbers = [1, 2, 3, 4, 5]
1504
- * const result = Array.chunksOf(numbers, 2)
1505
- * assert.deepStrictEqual(result, [[1, 2], [3, 4], [5]])
1527
+ * const result = Array.chunksOf([1, 2, 3, 4, 5], 2)
1528
+ * console.log(result) // [[1, 2], [3, 4], [5]]
1506
1529
  *
1507
1530
  * // Explanation:
1508
1531
  * // The `chunksOf` function takes an array of numbers `[1, 2, 3, 4, 5]` and a number `2`.
@@ -1524,12 +1547,13 @@ const chunksOf = exports.chunksOf = /*#__PURE__*/(0, _Function.dual)(2, (self, n
1524
1547
  /**
1525
1548
  * Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function.
1526
1549
  *
1527
- * @example
1550
+ * **Example**
1551
+ *
1528
1552
  * ```ts
1529
1553
  * import { Array } from "effect"
1530
1554
  *
1531
1555
  * const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y)
1532
- * assert.deepStrictEqual(result, [["a", "a"], ["b", "b", "b"], ["c"], ["a"]])
1556
+ * console.log(result) // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]
1533
1557
  * ```
1534
1558
  *
1535
1559
  * @category grouping
@@ -1552,12 +1576,13 @@ const groupWith = exports.groupWith = /*#__PURE__*/(0, _Function.dual)(2, (self,
1552
1576
  /**
1553
1577
  * Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s.
1554
1578
  *
1555
- * @example
1579
+ * **Example**
1580
+ *
1556
1581
  * ```ts
1557
1582
  * import { Array } from "effect"
1558
1583
  *
1559
1584
  * const result = Array.group([1, 1, 2, 2, 2, 3, 1])
1560
- * assert.deepStrictEqual(result, [[1, 1], [2, 2, 2], [3], [1]])
1585
+ * console.log(result) // [[1, 1], [2, 2, 2], [3], [1]]
1561
1586
  * ```
1562
1587
  *
1563
1588
  * @category grouping
@@ -1568,7 +1593,8 @@ const group = exports.group = /*#__PURE__*/groupWith( /*#__PURE__*/Equal.equival
1568
1593
  * Splits an `Iterable` into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning
1569
1594
  * function on each element, and grouping the results according to values returned
1570
1595
  *
1571
- * @example
1596
+ * **Example**
1597
+ *
1572
1598
  * ```ts
1573
1599
  * import { Array } from "effect"
1574
1600
  *
@@ -1577,11 +1603,13 @@ const group = exports.group = /*#__PURE__*/groupWith( /*#__PURE__*/Equal.equival
1577
1603
  * { name: "Bob", group: "B" },
1578
1604
  * { name: "Charlie", group: "A" }
1579
1605
  * ]
1606
+ *
1580
1607
  * const result = Array.groupBy(people, person => person.group)
1581
- * assert.deepStrictEqual(result, {
1582
- * A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }],
1583
- * B: [{ name: "Bob", group: "B" }]
1584
- * })
1608
+ * console.log(result)
1609
+ * // {
1610
+ * // A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }],
1611
+ * // B: [{ name: "Bob", group: "B" }]
1612
+ * // }
1585
1613
  * ```
1586
1614
  *
1587
1615
  * @category grouping
@@ -1602,14 +1630,13 @@ const groupBy = exports.groupBy = /*#__PURE__*/(0, _Function.dual)(2, (self, f)
1602
1630
  /**
1603
1631
  * Calculates the union of two arrays using the provided equivalence relation.
1604
1632
  *
1605
- * @example
1633
+ * **Example**
1634
+ *
1606
1635
  * ```ts
1607
1636
  * import { Array } from "effect"
1608
1637
  *
1609
- * const array1 = [1, 2]
1610
- * const array2 = [2, 3]
1611
- * const union = Array.unionWith(array1, array2, (a, b) => a === b)
1612
- * assert.deepStrictEqual(union, [1, 2, 3])
1638
+ * const union = Array.unionWith([1, 2], [2, 3], (a, b) => a === b)
1639
+ * console.log(union) // [1, 2, 3]
1613
1640
  * ```
1614
1641
  *
1615
1642
  * @since 2.0.0
@@ -1629,14 +1656,13 @@ const unionWith = exports.unionWith = /*#__PURE__*/(0, _Function.dual)(3, (self,
1629
1656
  /**
1630
1657
  * Creates a union of two arrays, removing duplicates.
1631
1658
  *
1632
- * @example
1659
+ * **Example**
1660
+ *
1633
1661
  * ```ts
1634
1662
  * import { Array } from "effect"
1635
1663
  *
1636
- * const array1 = [1, 2]
1637
- * const array2 = [2, 3]
1638
- * const result = Array.union(array1, array2)
1639
- * assert.deepStrictEqual(result, [1, 2, 3])
1664
+ * const result = Array.union([1, 2], [2, 3])
1665
+ * console.log(result) // [1, 2, 3]
1640
1666
  * ```
1641
1667
  *
1642
1668
  * @since 2.0.0
@@ -1646,7 +1672,8 @@ const union = exports.union = /*#__PURE__*/(0, _Function.dual)(2, (self, that) =
1646
1672
  * Creates an `Array` of unique values that are included in all given `Iterable`s using the provided `isEquivalent` function.
1647
1673
  * The order and references of result values are determined by the first `Iterable`.
1648
1674
  *
1649
- * @example
1675
+ * **Example**
1676
+ *
1650
1677
  * ```ts
1651
1678
  * import { Array } from "effect"
1652
1679
  *
@@ -1654,7 +1681,7 @@ const union = exports.union = /*#__PURE__*/(0, _Function.dual)(2, (self, that) =
1654
1681
  * const array2 = [{ id: 3 }, { id: 4 }, { id: 1 }]
1655
1682
  * const isEquivalent = (a: { id: number }, b: { id: number }) => a.id === b.id
1656
1683
  * const result = Array.intersectionWith(isEquivalent)(array2)(array1)
1657
- * assert.deepStrictEqual(result, [{ id: 1 }, { id: 3 }])
1684
+ * console.log(result) // [{ id: 1 }, { id: 3 }]
1658
1685
  * ```
1659
1686
  *
1660
1687
  * @since 2.0.0
@@ -1667,14 +1694,13 @@ const intersectionWith = isEquivalent => {
1667
1694
  * Creates an `Array` of unique values that are included in all given `Iterable`s.
1668
1695
  * The order and references of result values are determined by the first `Iterable`.
1669
1696
  *
1670
- * @example
1697
+ * **Example**
1698
+ *
1671
1699
  * ```ts
1672
1700
  * import { Array } from "effect"
1673
1701
  *
1674
- * const array1 = [1, 2, 3]
1675
- * const array2 = [3, 4, 1]
1676
- * const result = Array.intersection(array1, array2)
1677
- * assert.deepStrictEqual(result, [1, 3])
1702
+ * const result = Array.intersection([1, 2, 3], [3, 4, 1])
1703
+ * console.log(result) // [1, 3]
1678
1704
  * ```
1679
1705
  *
1680
1706
  * @since 2.0.0
@@ -1685,14 +1711,15 @@ const intersection = exports.intersection = /*#__PURE__*/intersectionWith(_equiv
1685
1711
  * Creates a `Array` of values not included in the other given `Iterable` using the provided `isEquivalent` function.
1686
1712
  * The order and references of result values are determined by the first `Iterable`.
1687
1713
  *
1688
- * @example
1714
+ * **Example**
1715
+ *
1689
1716
  * ```ts
1690
1717
  * import { Array } from "effect"
1691
1718
  *
1692
1719
  * const array1 = [1, 2, 3]
1693
1720
  * const array2 = [2, 3, 4]
1694
1721
  * const difference = Array.differenceWith<number>((a, b) => a === b)(array1, array2)
1695
- * assert.deepStrictEqual(difference, [1])
1722
+ * console.log(difference) // [1]
1696
1723
  * ```
1697
1724
  *
1698
1725
  * @since 2.0.0
@@ -1705,14 +1732,13 @@ const differenceWith = isEquivalent => {
1705
1732
  * Creates a `Array` of values not included in the other given `Iterable`.
1706
1733
  * The order and references of result values are determined by the first `Iterable`.
1707
1734
  *
1708
- * @example
1735
+ * **Example**
1736
+ *
1709
1737
  * ```ts
1710
1738
  * import { Array } from "effect"
1711
1739
  *
1712
- * const array1 = [1, 2, 3]
1713
- * const array2 = [2, 3, 4]
1714
- * const difference = Array.difference(array1, array2)
1715
- * assert.deepStrictEqual(difference, [1])
1740
+ * const difference = Array.difference([1, 2, 3], [2, 3, 4])
1741
+ * console.log(difference) // [1]
1716
1742
  * ```
1717
1743
  *
1718
1744
  * @since 2.0.0
@@ -1762,14 +1788,13 @@ const flatMap = exports.flatMap = /*#__PURE__*/(0, _Function.dual)(2, (self, f)
1762
1788
  * from each nested array. This function ensures that the structure of nested
1763
1789
  * arrays is collapsed into a single, flat array.
1764
1790
  *
1765
- * @example
1766
- * ```ts
1767
- * import { Array } from "effect";
1791
+ * **Example**
1768
1792
  *
1769
- * const nestedArrays = [[1, 2], [], [3, 4], [], [5, 6]]
1770
- * const result = Array.flatten(nestedArrays)
1793
+ * ```ts
1794
+ * import { Array } from "effect"
1771
1795
  *
1772
- * assert.deepStrictEqual(result, [1, 2, 3, 4, 5, 6]);
1796
+ * const result = Array.flatten([[1, 2], [], [3, 4], [], [5, 6]])
1797
+ * console.log(result) // [1, 2, 3, 4, 5, 6]
1773
1798
  * ```
1774
1799
  *
1775
1800
  * @category sequencing
@@ -1780,15 +1805,15 @@ const flatten = exports.flatten = /*#__PURE__*/flatMap(_Function.identity);
1780
1805
  * Applies a function to each element of the `Iterable` and filters based on the result, keeping the transformed values where the function returns `Some`.
1781
1806
  * This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
1782
1807
  *
1783
- * @example
1808
+ * **Example**
1809
+ *
1784
1810
  * ```ts
1785
- * import { Array, Option } from "effect";
1811
+ * import { Array, Option } from "effect"
1786
1812
  *
1787
- * const data = [1, 2, 3, 4, 5];
1788
- * const evenSquares = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none();
1789
- * const result = Array.filterMap(data, evenSquares);
1813
+ * const evenSquares = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none()
1790
1814
  *
1791
- * assert.deepStrictEqual(result, [4, 16]);
1815
+ * const result = Array.filterMap([1, 2, 3, 4, 5], evenSquares);
1816
+ * console.log(result) // [4, 16]
1792
1817
  * ```
1793
1818
  *
1794
1819
  * @category filtering
@@ -1810,15 +1835,15 @@ const filterMap = exports.filterMap = /*#__PURE__*/(0, _Function.dual)(2, (self,
1810
1835
  * This method combines filtering and mapping in a single pass, and short-circuits, i.e., stops processing, as soon as the function returns `None`.
1811
1836
  * This is useful when you need to transform an array but only up to the point where a certain condition holds true.
1812
1837
  *
1813
- * @example
1838
+ * **Example**
1839
+ *
1814
1840
  * ```ts
1815
- * import { Array, Option } from "effect";
1841
+ * import { Array, Option } from "effect"
1816
1842
  *
1817
- * const data = [2, 4, 5];
1818
- * const toSquareTillOdd = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none();
1819
- * const result = Array.filterMapWhile(data, toSquareTillOdd);
1843
+ * const toSquareTillOdd = (x: number) => x % 2 === 0 ? Option.some(x * x) : Option.none()
1820
1844
  *
1821
- * assert.deepStrictEqual(result, [4, 16]);
1845
+ * const result = Array.filterMapWhile([2, 4, 5], toSquareTillOdd)
1846
+ * console.log(result) // [4, 16]
1822
1847
  * ```
1823
1848
  *
1824
1849
  * @category filtering
@@ -1844,20 +1869,21 @@ const filterMapWhile = exports.filterMapWhile = /*#__PURE__*/(0, _Function.dual)
1844
1869
  * and you want to separate these types into different collections. For instance, separating validation results
1845
1870
  * into successes and failures.
1846
1871
  *
1847
- * @example
1872
+ * **Example**
1873
+ *
1848
1874
  * ```ts
1849
1875
  * import { Array, Either } from "effect";
1850
1876
  *
1851
- * const data = [1, 2, 3, 4, 5]
1852
1877
  * const isEven = (x: number) => x % 2 === 0
1853
- * const partitioned = Array.partitionMap(data, x =>
1878
+ *
1879
+ * const result = Array.partitionMap([1, 2, 3, 4, 5], x =>
1854
1880
  * isEven(x) ? Either.right(x) : Either.left(x)
1855
1881
  * )
1856
- *
1857
- * assert.deepStrictEqual(partitioned, [
1858
- * [1, 3, 5],
1859
- * [2, 4]
1860
- * ])
1882
+ * console.log(result)
1883
+ * // [
1884
+ * // [1, 3, 5],
1885
+ * // [2, 4]
1886
+ * // ]
1861
1887
  * ```
1862
1888
  *
1863
1889
  * @category filtering
@@ -1880,14 +1906,13 @@ const partitionMap = exports.partitionMap = /*#__PURE__*/(0, _Function.dual)(2,
1880
1906
  /**
1881
1907
  * Retrieves the `Some` values from an `Iterable` of `Option`s, collecting them into an array.
1882
1908
  *
1883
- * @example
1909
+ * **Example**
1910
+ *
1884
1911
  * ```ts
1885
1912
  * import { Array, Option } from "effect"
1886
1913
  *
1887
- * assert.deepStrictEqual(
1888
- * Array.getSomes([Option.some(1), Option.none(), Option.some(2)]),
1889
- * [1, 2]
1890
- * )
1914
+ * const result = Array.getSomes([Option.some(1), Option.none(), Option.some(2)])
1915
+ * console.log(result) // [1, 2]
1891
1916
  * ```
1892
1917
  *
1893
1918
  * @category filtering
@@ -1897,14 +1922,13 @@ const getSomes = exports.getSomes = /*#__PURE__*/filterMap(_Function.identity);
1897
1922
  /**
1898
1923
  * Retrieves the `Left` values from an `Iterable` of `Either`s, collecting them into an array.
1899
1924
  *
1900
- * @example
1925
+ * **Example**
1926
+ *
1901
1927
  * ```ts
1902
1928
  * import { Array, Either } from "effect"
1903
1929
  *
1904
- * assert.deepStrictEqual(
1905
- * Array.getLefts([Either.right(1), Either.left("err"), Either.right(2)]),
1906
- * ["err"]
1907
- * )
1930
+ * const result = Array.getLefts([Either.right(1), Either.left("err"), Either.right(2)])
1931
+ * console.log(result) // ["err"]
1908
1932
  * ```
1909
1933
  *
1910
1934
  * @category filtering
@@ -1922,14 +1946,13 @@ const getLefts = self => {
1922
1946
  /**
1923
1947
  * Retrieves the `Right` values from an `Iterable` of `Either`s, collecting them into an array.
1924
1948
  *
1925
- * @example
1949
+ * **Example**
1950
+ *
1926
1951
  * ```ts
1927
1952
  * import { Array, Either } from "effect"
1928
1953
  *
1929
- * assert.deepStrictEqual(
1930
- * Array.getRights([Either.right(1), Either.left("err"), Either.right(2)]),
1931
- * [1, 2]
1932
- * )
1954
+ * const result = Array.getRights([Either.right(1), Either.left("err"), Either.right(2)])
1955
+ * console.log(result) // [1, 2]
1933
1956
  * ```
1934
1957
  *
1935
1958
  * @category filtering
@@ -1963,15 +1986,13 @@ const filter = exports.filter = /*#__PURE__*/(0, _Function.dual)(2, (self, predi
1963
1986
  /**
1964
1987
  * Separate elements based on a predicate that also exposes the index of the element.
1965
1988
  *
1966
- * @example
1989
+ * **Example**
1990
+ *
1967
1991
  * ```ts
1968
1992
  * import { Array } from "effect"
1969
1993
  *
1970
- * const numbers = [1, 2, 3, 4]
1971
- *
1972
- * const result = Array.partition(numbers, n => n % 2 === 0)
1973
- *
1974
- * assert.deepStrictEqual(result, [[1, 3], [2, 4]])
1994
+ * const result = Array.partition([1, 2, 3, 4], n => n % 2 === 0)
1995
+ * console.log(result) // [[1, 3], [2, 4]]
1975
1996
  * ```
1976
1997
  *
1977
1998
  * @category filtering
@@ -2000,13 +2021,13 @@ const separate = exports.separate = /*#__PURE__*/partitionMap(_Function.identity
2000
2021
  /**
2001
2022
  * Reduces an array from the left.
2002
2023
  *
2003
- * @example
2024
+ * **Example**
2025
+ *
2004
2026
  * ```ts
2005
2027
  * import { Array } from "effect"
2006
2028
  *
2007
- * const numbers = [1, 2, 3]
2008
- * const result = Array.reduce(numbers, 0, (acc, n) => acc + n)
2009
- * assert.deepStrictEqual(result, 6)
2029
+ * const result = Array.reduce([1, 2, 3], 0, (acc, n) => acc + n)
2030
+ * console.log(result) // 6
2010
2031
  * ```
2011
2032
  *
2012
2033
  * @category folding
@@ -2016,13 +2037,13 @@ const reduce = exports.reduce = /*#__PURE__*/(0, _Function.dual)(3, (self, b, f)
2016
2037
  /**
2017
2038
  * Reduces an array from the right.
2018
2039
  *
2019
- * @example
2040
+ * **Example**
2041
+ *
2020
2042
  * ```ts
2021
2043
  * import { Array } from "effect"
2022
2044
  *
2023
- * const numbers = [1, 2, 3]
2024
- * const result = Array.reduceRight(numbers, 0, (acc, n) => acc + n)
2025
- * assert.deepStrictEqual(result, 6)
2045
+ * const result = Array.reduceRight([1, 2, 3], 0, (acc, n) => acc + n)
2046
+ * console.log(result) // 6
2026
2047
  * ```
2027
2048
  *
2028
2049
  * @category folding
@@ -2032,14 +2053,15 @@ const reduceRight = exports.reduceRight = /*#__PURE__*/(0, _Function.dual)(3, (s
2032
2053
  /**
2033
2054
  * Lifts a predicate into an array.
2034
2055
  *
2035
- * @example
2056
+ * **Example**
2057
+ *
2036
2058
  * ```ts
2037
2059
  * import { Array } from "effect"
2038
2060
  *
2039
2061
  * const isEven = (n: number) => n % 2 === 0
2040
2062
  * const to = Array.liftPredicate(isEven)
2041
- * assert.deepStrictEqual(to(1), [])
2042
- * assert.deepStrictEqual(to(2), [2])
2063
+ * console.log(to(1)) // []
2064
+ * console.log(to(2)) // [2]
2043
2065
  * ```
2044
2066
  *
2045
2067
  * @category lifting
@@ -2067,13 +2089,13 @@ const liftNullable = f => (...a) => fromNullable(f(...a));
2067
2089
  /**
2068
2090
  * Maps over an array and flattens the result, removing null and undefined values.
2069
2091
  *
2070
- * @example
2092
+ * **Example**
2093
+ *
2071
2094
  * ```ts
2072
2095
  * import { Array } from "effect"
2073
2096
  *
2074
- * const numbers = [1, 2, 3]
2075
- * const result = Array.flatMapNullable(numbers, n => (n % 2 === 0 ? null : n))
2076
- * assert.deepStrictEqual(result, [1, 3])
2097
+ * const result = Array.flatMapNullable([1, 2, 3], n => (n % 2 === 0 ? null : n))
2098
+ * console.log(result) // [1, 3]
2077
2099
  *
2078
2100
  * // Explanation:
2079
2101
  * // The array of numbers [1, 2, 3] is mapped with a function that returns null for even numbers
@@ -2091,7 +2113,8 @@ const flatMapNullable = exports.flatMapNullable = /*#__PURE__*/(0, _Function.dua
2091
2113
  * If the `Either` is a left, it returns an empty array.
2092
2114
  * If the `Either` is a right, it returns an array with the right value.
2093
2115
  *
2094
- * @example
2116
+ * **Example**
2117
+ *
2095
2118
  * ```ts
2096
2119
  * import { Array, Either } from "effect"
2097
2120
  *
@@ -2101,10 +2124,10 @@ const flatMapNullable = exports.flatMapNullable = /*#__PURE__*/(0, _Function.dua
2101
2124
  * const liftedParseNumber = Array.liftEither(parseNumber)
2102
2125
  *
2103
2126
  * const result1 = liftedParseNumber("42")
2104
- * assert.deepStrictEqual(result1, [42])
2127
+ * console.log(result1) // [42]
2105
2128
  *
2106
2129
  * const result2 = liftedParseNumber("not a number")
2107
- * assert.deepStrictEqual(result2, [])
2130
+ * console.log(result2) // []
2108
2131
  *
2109
2132
  * // Explanation:
2110
2133
  * // The function parseNumber is lifted to return an array.
@@ -2137,13 +2160,13 @@ const some = exports.some = /*#__PURE__*/(0, _Function.dual)(2, (self, predicate
2137
2160
  /**
2138
2161
  * Extends an array with a function that maps each subarray to a value.
2139
2162
  *
2140
- * @example
2163
+ * **Example**
2164
+ *
2141
2165
  * ```ts
2142
2166
  * import { Array } from "effect"
2143
2167
  *
2144
- * const numbers = [1, 2, 3]
2145
- * const result = Array.extend(numbers, as => as.length)
2146
- * assert.deepStrictEqual(result, [3, 2, 1])
2168
+ * const result = Array.extend([1, 2, 3], as => as.length)
2169
+ * console.log(result) // [3, 2, 1]
2147
2170
  *
2148
2171
  * // Explanation:
2149
2172
  * // The function maps each subarray starting from each element to its length.
@@ -2158,12 +2181,13 @@ const extend = exports.extend = /*#__PURE__*/(0, _Function.dual)(2, (self, f) =>
2158
2181
  /**
2159
2182
  * Finds the minimum element in an array based on a comparator.
2160
2183
  *
2161
- * @example
2184
+ * **Example**
2185
+ *
2162
2186
  * ```ts
2163
2187
  * import { Array, Order } from "effect"
2164
2188
  *
2165
- * const min = Array.min([3, 1, 2], Order.number)
2166
- * assert.deepStrictEqual(min, 1)
2189
+ * const result = Array.min([3, 1, 2], Order.number)
2190
+ * console.log(result) // 1
2167
2191
  * ```
2168
2192
  *
2169
2193
  * @since 2.0.0
@@ -2172,12 +2196,13 @@ const min = exports.min = /*#__PURE__*/(0, _Function.dual)(2, (self, O) => self.
2172
2196
  /**
2173
2197
  * Finds the maximum element in an array based on a comparator.
2174
2198
  *
2175
- * @example
2199
+ * **Example**
2200
+ *
2176
2201
  * ```ts
2177
2202
  * import { Array, Order } from "effect"
2178
2203
  *
2179
- * const max = Array.max([3, 1, 2], Order.number)
2180
- * assert.deepStrictEqual(max, 3)
2204
+ * const result = Array.max([3, 1, 2], Order.number)
2205
+ * console.log(result) // 3
2181
2206
  * ```
2182
2207
  *
2183
2208
  * @since 2.0.0
@@ -2212,14 +2237,13 @@ const getOrder = exports.getOrder = Order.array;
2212
2237
  /**
2213
2238
  * Creates an equivalence relation for arrays.
2214
2239
  *
2215
- * @example
2240
+ * **Example**
2241
+ *
2216
2242
  * ```ts
2217
2243
  * import { Array } from "effect"
2218
2244
  *
2219
- * const numbers1 = [1, 2, 3]
2220
- * const numbers2 = [1, 2, 3]
2221
2245
  * const eq = Array.getEquivalence<number>((a, b) => a === b)
2222
- * assert.deepStrictEqual(eq(numbers1, numbers2), true)
2246
+ * console.log(eq([1, 2, 3], [1, 2, 3])) // true
2223
2247
  * ```
2224
2248
  *
2225
2249
  * @category instances
@@ -2229,12 +2253,12 @@ const getEquivalence = exports.getEquivalence = Equivalence.array;
2229
2253
  /**
2230
2254
  * Performs a side-effect for each element of the `Iterable`.
2231
2255
  *
2232
- * @example
2256
+ * **Example**
2257
+ *
2233
2258
  * ```ts
2234
2259
  * import { Array } from "effect"
2235
2260
  *
2236
- * const numbers = [1, 2, 3]
2237
- * Array.forEach(numbers, n => console.log(n)) // 1, 2, 3
2261
+ * Array.forEach([1, 2, 3], n => console.log(n)) // 1, 2, 3
2238
2262
  * ```
2239
2263
  *
2240
2264
  * @since 2.0.0
@@ -2244,13 +2268,13 @@ const forEach = exports.forEach = /*#__PURE__*/(0, _Function.dual)(2, (self, f)
2244
2268
  * Remove duplicates from an `Iterable` using the provided `isEquivalent` function,
2245
2269
  * preserving the order of the first occurrence of each element.
2246
2270
  *
2247
- * @example
2271
+ * **Example**
2272
+ *
2248
2273
  * ```ts
2249
2274
  * import { Array } from "effect"
2250
2275
  *
2251
- * const numbers = [1, 2, 2, 3, 3, 3]
2252
- * const unique = Array.dedupeWith(numbers, (a, b) => a === b)
2253
- * assert.deepStrictEqual(unique, [1, 2, 3])
2276
+ * const result = Array.dedupeWith([1, 2, 2, 3, 3, 3], (a, b) => a === b)
2277
+ * console.log(result) // [1, 2, 3]
2254
2278
  * ```
2255
2279
  *
2256
2280
  * @since 2.0.0
@@ -2279,13 +2303,13 @@ const dedupe = self => dedupeWith(self, Equal.equivalence());
2279
2303
  /**
2280
2304
  * Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
2281
2305
  *
2282
- * @example
2306
+ * **Example**
2307
+ *
2283
2308
  * ```ts
2284
2309
  * import { Array } from "effect"
2285
2310
  *
2286
- * const numbers = [1, 1, 2, 2, 3, 3]
2287
- * const unique = Array.dedupeAdjacentWith(numbers, (a, b) => a === b)
2288
- * assert.deepStrictEqual(unique, [1, 2, 3])
2311
+ * const result = Array.dedupeAdjacentWith([1, 1, 2, 2, 3, 3], (a, b) => a === b)
2312
+ * console.log(result) // [1, 2, 3]
2289
2313
  * ```
2290
2314
  *
2291
2315
  * @since 2.0.0
@@ -2305,13 +2329,13 @@ const dedupeAdjacentWith = exports.dedupeAdjacentWith = /*#__PURE__*/(0, _Functi
2305
2329
  /**
2306
2330
  * Deduplicates adjacent elements that are identical.
2307
2331
  *
2308
- * @example
2332
+ * **Example**
2333
+ *
2309
2334
  * ```ts
2310
2335
  * import { Array } from "effect"
2311
2336
  *
2312
- * const numbers = [1, 1, 2, 2, 3, 3]
2313
- * const unique = Array.dedupeAdjacent(numbers)
2314
- * assert.deepStrictEqual(unique, [1, 2, 3])
2337
+ * const result = Array.dedupeAdjacent([1, 1, 2, 2, 3, 3])
2338
+ * console.log(result) // [1, 2, 3]
2315
2339
  * ```
2316
2340
  *
2317
2341
  * @since 2.0.0
@@ -2320,13 +2344,14 @@ const dedupeAdjacent = exports.dedupeAdjacent = /*#__PURE__*/dedupeAdjacentWith(
2320
2344
  /**
2321
2345
  * Joins the elements together with "sep" in the middle.
2322
2346
  *
2323
- * @example
2347
+ * **Example**
2348
+ *
2324
2349
  * ```ts
2325
2350
  * import { Array } from "effect"
2326
2351
  *
2327
2352
  * const strings = ["a", "b", "c"]
2328
2353
  * const joined = Array.join(strings, "-")
2329
- * assert.deepStrictEqual(joined, "a-b-c")
2354
+ * console.log(joined) // "a-b-c"
2330
2355
  * ```
2331
2356
  *
2332
2357
  * @since 2.0.0
@@ -2336,13 +2361,13 @@ const join = exports.join = /*#__PURE__*/(0, _Function.dual)(2, (self, sep) => f
2336
2361
  /**
2337
2362
  * Statefully maps over the chunk, producing new elements of type `B`.
2338
2363
  *
2339
- * @example
2364
+ * **Example**
2365
+ *
2340
2366
  * ```ts
2341
2367
  * import { Array } from "effect"
2342
2368
  *
2343
- * const numbers = [1, 2, 3]
2344
- * const result = Array.mapAccum(numbers, 0, (acc, n) => [acc + n, acc + n])
2345
- * assert.deepStrictEqual(result, [6, [1, 3, 6]])
2369
+ * const result = Array.mapAccum([1, 2, 3], 0, (acc, n) => [acc + n, acc + n])
2370
+ * console.log(result) // [6, [1, 3, 6]]
2346
2371
  * ```
2347
2372
  *
2348
2373
  * @since 2.0.0
@@ -2363,14 +2388,13 @@ const mapAccum = exports.mapAccum = /*#__PURE__*/(0, _Function.dual)(3, (self, s
2363
2388
  /**
2364
2389
  * Zips this chunk crosswise with the specified chunk using the specified combiner.
2365
2390
  *
2366
- * @example
2391
+ * **Example**
2392
+ *
2367
2393
  * ```ts
2368
2394
  * import { Array } from "effect"
2369
2395
  *
2370
- * const array1 = [1, 2]
2371
- * const array2 = ["a", "b"]
2372
- * const product = Array.cartesianWith(array1, array2, (a, b) => `${a}-${b}`)
2373
- * assert.deepStrictEqual(product, ["1-a", "1-b", "2-a", "2-b"])
2396
+ * const result = Array.cartesianWith([1, 2], ["a", "b"], (a, b) => `${a}-${b}`)
2397
+ * console.log(result) // ["1-a", "1-b", "2-a", "2-b"]
2374
2398
  * ```
2375
2399
  *
2376
2400
  * @since 2.0.0
@@ -2380,14 +2404,13 @@ const cartesianWith = exports.cartesianWith = /*#__PURE__*/(0, _Function.dual)(3
2380
2404
  /**
2381
2405
  * Zips this chunk crosswise with the specified chunk.
2382
2406
  *
2383
- * @example
2407
+ * **Example**
2408
+ *
2384
2409
  * ```ts
2385
2410
  * import { Array } from "effect"
2386
2411
  *
2387
- * const array1 = [1, 2]
2388
- * const array2 = ["a", "b"]
2389
- * const product = Array.cartesian(array1, array2)
2390
- * assert.deepStrictEqual(product, [[1, "a"], [1, "b"], [2, "a"], [2, "b"]])
2412
+ * const result = Array.cartesian([1, 2], ["a", "b"])
2413
+ * console.log(result) // [[1, "a"], [1, "b"], [2, "a"], [2, "b"]]
2391
2414
  * ```
2392
2415
  *
2393
2416
  * @since 2.0.0
@@ -2411,21 +2434,19 @@ const cartesian = exports.cartesian = /*#__PURE__*/(0, _Function.dual)(2, (self,
2411
2434
  * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
2412
2435
  * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
2413
2436
  *
2414
- * @see {@link bindTo}
2415
- * @see {@link bind}
2416
- * @see {@link let_ let}
2437
+ * **Example**
2417
2438
  *
2418
- * @example
2419
2439
  * ```ts
2420
- * import { Array as Arr, pipe } from "effect"
2440
+ * import { Array, pipe } from "effect"
2441
+ *
2421
2442
  * const doResult = pipe(
2422
- * Arr.Do,
2423
- * Arr.bind("x", () => [1, 3, 5]),
2424
- * Arr.bind("y", () => [2, 4, 6]),
2425
- * Arr.filter(({ x, y }) => x < y), // condition
2426
- * Arr.map(({ x, y }) => [x, y] as const) // transformation
2443
+ * Array.Do,
2444
+ * Array.bind("x", () => [1, 3, 5]),
2445
+ * Array.bind("y", () => [2, 4, 6]),
2446
+ * Array.filter(({ x, y }) => x < y), // condition
2447
+ * Array.map(({ x, y }) => [x, y] as const) // transformation
2427
2448
  * )
2428
- * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]])
2449
+ * console.log(doResult) // [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]]
2429
2450
  *
2430
2451
  * // equivalent
2431
2452
  * const x = [1, 3, 5],
@@ -2439,6 +2460,10 @@ const cartesian = exports.cartesian = /*#__PURE__*/(0, _Function.dual)(2, (self,
2439
2460
  * }
2440
2461
  * ```
2441
2462
  *
2463
+ * @see {@link bindTo}
2464
+ * @see {@link bind}
2465
+ * @see {@link let_ let}
2466
+ *
2442
2467
  * @category do notation
2443
2468
  * @since 3.2.0
2444
2469
  */
@@ -2457,21 +2482,19 @@ const Do = exports.Do = /*#__PURE__*/of({});
2457
2482
  * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
2458
2483
  * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
2459
2484
  *
2460
- * @see {@link bindTo}
2461
- * @see {@link Do}
2462
- * @see {@link let_ let}
2485
+ * **Example**
2463
2486
  *
2464
- * @example
2465
2487
  * ```ts
2466
- * import { Array as Arr, pipe } from "effect"
2488
+ * import { Array, pipe } from "effect"
2489
+ *
2467
2490
  * const doResult = pipe(
2468
- * Arr.Do,
2469
- * Arr.bind("x", () => [1, 3, 5]),
2470
- * Arr.bind("y", () => [2, 4, 6]),
2471
- * Arr.filter(({ x, y }) => x < y), // condition
2472
- * Arr.map(({ x, y }) => [x, y] as const) // transformation
2491
+ * Array.Do,
2492
+ * Array.bind("x", () => [1, 3, 5]),
2493
+ * Array.bind("y", () => [2, 4, 6]),
2494
+ * Array.filter(({ x, y }) => x < y), // condition
2495
+ * Array.map(({ x, y }) => [x, y] as const) // transformation
2473
2496
  * )
2474
- * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]])
2497
+ * console.log(doResult) // [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]]
2475
2498
  *
2476
2499
  * // equivalent
2477
2500
  * const x = [1, 3, 5],
@@ -2485,6 +2508,10 @@ const Do = exports.Do = /*#__PURE__*/of({});
2485
2508
  * }
2486
2509
  * ```
2487
2510
  *
2511
+ * @see {@link bindTo}
2512
+ * @see {@link Do}
2513
+ * @see {@link let_ let}
2514
+ *
2488
2515
  * @category do notation
2489
2516
  * @since 3.2.0
2490
2517
  */
@@ -2503,21 +2530,19 @@ const bind = exports.bind = /*#__PURE__*/doNotation.bind(map, flatMap);
2503
2530
  * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
2504
2531
  * 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
2505
2532
  *
2506
- * @see {@link bindTo}
2507
- * @see {@link Do}
2508
- * @see {@link let_ let}
2533
+ * **Example**
2509
2534
  *
2510
- * @example
2511
2535
  * ```ts
2512
- * import { Array as Arr, pipe } from "effect"
2536
+ * import { Array, pipe } from "effect"
2537
+ *
2513
2538
  * const doResult = pipe(
2514
- * Arr.Do,
2515
- * Arr.bind("x", () => [1, 3, 5]),
2516
- * Arr.bind("y", () => [2, 4, 6]),
2517
- * Arr.filter(({ x, y }) => x < y), // condition
2518
- * Arr.map(({ x, y }) => [x, y] as const) // transformation
2539
+ * Array.Do,
2540
+ * Array.bind("x", () => [1, 3, 5]),
2541
+ * Array.bind("y", () => [2, 4, 6]),
2542
+ * Array.filter(({ x, y }) => x < y), // condition
2543
+ * Array.map(({ x, y }) => [x, y] as const) // transformation
2519
2544
  * )
2520
- * assert.deepStrictEqual(doResult, [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]])
2545
+ * console.log(doResult) // [[1, 2], [1, 4], [1, 6], [3, 4], [3, 6], [5, 6]]
2521
2546
  *
2522
2547
  * // equivalent
2523
2548
  * const x = [1, 3, 5],
@@ -2531,6 +2556,10 @@ const bind = exports.bind = /*#__PURE__*/doNotation.bind(map, flatMap);
2531
2556
  * }
2532
2557
  * ```
2533
2558
  *
2559
+ * @see {@link bindTo}
2560
+ * @see {@link Do}
2561
+ * @see {@link let_ let}
2562
+ *
2534
2563
  * @category do notation
2535
2564
  * @since 3.2.0
2536
2565
  */